LoginSignup
5
4

More than 5 years have passed since last update.

PHP開発中の curl: (60) Peer certificate cannot be authenticated with known CA certificates 対応方法

Last updated at Posted at 2017-10-11

Laravelを使用してYahoo! JAPAN IDログイン機能を実装中、サーバーからYahooのWebAPIにHTTPSリクエストを送った際 curl: (60) Peer certificate cannot be authenticated with known CA certificates のエラーが出た。

私の環境ではcurlにCA証明書を使うように設定することでうまくいったのでメモ。
CentOS6 + Apache2.2 + PHP5.6 と古い環境ですが。

・まずCA証明書取得
sudo -i
cd /etc/httpd/conf.d
mkdir pem
cd pem
wget http://curl.haxx.se/ca/cacert.pem

・次に/etc/php.ini の[curl]のところに以下のように設定
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo ="/etc/httpd/conf.d/pem/cacert.pem"

・最後にApacheの再起動
service httpd restart

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4