Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google PHP API Client: CA cert error

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 ...

like image 865
mykisscool Avatar asked Aug 15 '13 14:08

mykisscool


1 Answers

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!

like image 188
Mike T Avatar answered Nov 18 '22 21:11

Mike T