How to fix the ‘cURL error 60: SSL certificate: unable to get local issuer certificate’ error with PHP?

Spread the love

Sometimes, we want to fix the ‘cURL error 60: SSL certificate: unable to get local issuer certificate’ error with PHP.

In this article, we’ll look at how to fix the ‘cURL error 60: SSL certificate: unable to get local issuer certificate’ error with PHP.

How to fix the ‘cURL error 60: SSL certificate: unable to get local issuer certificate’ error with PHP?

To fix the ‘cURL error 60: SSL certificate: unable to get local issuer certificate’ error with PHP, we download the certificate and set the paths of the certificate files in the server php.ini file.

First, we download and extract cacert.pem following the instructions at https://curl.se/docs/caextract.html

Then we save the files on our file system somewhere. XAMPP users might use C:\xampp\php\extras\ssl\cacert.pem)

Then in our php.ini file, put the following in [curl] and [openssl] section`

[curl]
curl.cainfo = "C:\xampp\php\extras\ssl\cacert.pem"

[openssl]
openssl.cafile = "C:\xampp\php\extras\ssl\cacert.pem"

Conclusion

To fix the ‘cURL error 60: SSL certificate: unable to get local issuer certificate’ error with PHP, we download the certificate and set the paths of the certificate files in the server php.ini file.

Leave a Reply

Your email address will not be published.