It turns out thatÂ my Google Sheets API instructions don’t work right away on Windows. Â People running WAMP or XAMPP have been reporting “cURL error 60: SSL certificate problem: unable to get local issuer certificate”.
For some reason, cURL on Windows doesn’t come with a certificate bundle, so it can’t verify Google’s certificate to establish a TLS/SSL connection. Â There are many articles out there making it sound really simple — just
- download a cacert.pem file
- add a line to your php.ini file: “curl.cainfo =Â path to cacert file“
But it took me hours to work out the details. Â First, the cacert.pem file that most people point you to (atÂ curl.haxx.se/docs/caextract.html) didn’t work for me. Â After a while, I found that the cacert.pem from Shane Stebner atÂ flwebsites.biz/posts/how-fix-curl-error-60-ssl-issue made all the difference. Â I haven’t figured out why.
Second, note that there are at least two php.info files on your system: Â one for running php from the command line (mine is C:\wamp\bin\php\php5.5.12\php.ini), and another for when php is called by Apache (for me, that’sÂ C:\wamp\bin\apache\apache2.4.9\bin\php.ini). Â Since I’m running php from the command line, I only edited the first one.
I saved the cacert.pem file in c:\wamp and added this to my php.ini: curl.cainfo = c:\wamp\cacert.pem. Â It didn’t matter which kind of slashes I used.
Hope this helps a few people start accessing Google Sheets with PHP!