Google PHP API Client: CA cert error

curl, google-api, php

Solution

Courtesy of rmckay at webaware dot com dot au:

Please everyone, stop setting CURLOPT_SSL_VERIFYPEER to false or 0. If your PHP installation doesn't have an up-to-date CA root certificate bundle, download the one at the curl website and save it on your server:

http://curl.haxx.se/docs/caextract.html

Then set a path to it in your `php.ini` file, e.g. on Windows:

curl.cainfo=c:\php\cacert.pem

Turning off `CURLOPT_SSL_VERIFYPEER` allows man in the middle (MITM) attacks, which you don't want!

Problem

I'm attempting to interface with the Google PHP API client and I am having issues with the certificate provided by Google: Google error: ``` SSL certificate problem, verify that the CA cert is OK. Retrying with the CA cert bundle from google-api-php-client. ``` PHP cURL error: ``` SSL certificate problem: unable to get local issuer certificate ``` I had no problems whatsoever on a Linux box. These errors are occuring on a Windows box. I've tried a couple of different solutions: https://code.google.com/ http://richardwarrender.com/ but to no avail. PS: ``` curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); ``` won't be acceptable ...

Original source