Solved: cURL error 60 with Sheets API access from Windows

Broken_Lock_CurlIt 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

  1. download a cacert.pem file
  2. 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!

2 thoughts on “Solved: cURL error 60 with Sheets API access from Windows

  1. Francisco

    Thank you so much man!! I was looking everywhere on how to resolve this issue but seemed I was getting to nowhere. What solved my problem was this:

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

    Once again… thank you so much!!!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *