PHP・GoogleAPIで「cURL error 60」
以前、GoogleAPI使ってゴニョゴニョしていて・・・新たにGoogleAPIをDLして使うと「cURL error 60」が出てきた。
作成日:2017-11-28, 更新日:2017-11-28
基本
やっていることは「Google認証→サーチコンソールのデータ取得」。
上記自体は問題なく動いている。
今回、新たに「google-api-php-client」ってのは差し替えるとエラーになった。
Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in C:\xampp\htdocs~
Xamppでエラー
あれこれ調べたら・・・英語のQ&Aにそのものずばり解決策が載ってた。
1.download and extract for cacert.pem here (a clean file format/data)
https://gist.github.com/VersatilityWerks/5719158/download2.put it in :
C:\xampp\php\extras\ssl\cacert.pem3.Add this line to your php.ini
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"4.restart your webserver/apache
引用元:cURL error 60: SSL certificate prblm: unable to get local issuer certificate
「1」で「cacert.pem」がダウンロードされるので、「2」の場所に移動。
「php.ini」の中から「curl.cainfo」を探して「3」のように修正。
Xamppのapache再起動。
※「php.ini」の中に「curl.cainfo」が見つからなければ最後の行に追記。