Sometimes, when we make a curl call to third party services, we get an error curl: (60) SSL certificate : unable to get local issuer certificate.
This error occurs because the curl verifies and makes a secure connection request using self-signed certificate. When it does not find the valid certificate, it throws an error.
To fix this error, follow the steps below:
- Open http://curl.haxx.se/ca/cacert.pem
- Copy the entire page and save it as a “cacert.pem”
- Open your php.ini file and insert or update the following line.
- curl.cainfo = “[pathtofile]cacert.pem”
Example Like :
[curl]
curl.cainfo = “C:\xampp\php\extras\ssl\cacert.pem”
[openssl]
openssl.cafile = “C:\xampp\php\extras\ssl\cacert.pem”
For Wamp :
http://curl.haxx.se/ca/cacert.pem
Copy the entire page and save it as: cacert.pem, in the location mentioned below.
Be sure that you open the php.ini file directly by your Window Explorer. (in my case: C:\DevPrograms\wamp64\bin\php\php5.6.25).
Don’t use the shortcut to php.ini in the Wamp/Xamp icon’s menu in the System Tray. This shortcut doesn’t work in this case.
Then edit that php.ini :
curl.cainfo =”C:/DevPrograms/wamp64/bin/php/cacert.pem”
and
openssl.cafile=”C:/DevPrograms/wamp64/bin/php/cacert.pem”
After saving php.ini you don’t need to “Restart All Services” in Wamp icon or close/re-open CMD.
Reference :
https://stackoverflow.com/questions/29822686/curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificate