fix “SSL certificate problem: unable to get local issuer certificate” error


When you execute PHP CURL calls to HTTPS URLs, you might get the following error:

SSL certificate problem: unable to get local issuer certificate

This means that the root certificates on the system are invalid.

You have 3 different ways to proceed:

  • Maintain SSL enabled – change php.ini:
    • Downloaded cacert.pem from http://curl.haxx.se/ca/cacert.pem
    • Copy cacert.pem to ‘/usr/local/openssl-0.9.8/certs/cacert.pem’  // Or whatever version of openssl / zend you have.
    • Modify CURL configuration on your php.ini file:
      • Below [curl] add => cainfo = ‘/usr/local/openssl-0.9.8/certs/cacert.pem’
    • Restart PHP and check if CURL can read from HTTPS URL.
  • Maintain SSL enabled – do not change php.ini:
    • Use the following code to use the credentials you got on the previous step:
  • Disable SSL – NOT RECOMMENDED:

    •  

+ There are no comments

Add yours