PHP - SSL certificate error: unable to get local issuer certificate PHP - SSL certificate error: unable to get local issuer certificate php php

PHP - SSL certificate error: unable to get local issuer certificate


Finally got this to work!

  1. Download the certificate bundle.

  2. Put it somewhere. In my case, that was c:\wamp\ directory (if you are using Wamp 64 bit then it's c:\wamp64\).

  3. Enable mod_ssl in Apache and php_openssl.dll in php.ini (uncomment them by removing ; at the beginning). But be careful, my problem was that I had two php.ini files and I need to do this in both of them. One is the one you get from your WAMP taskbar icon, and another one is, in my case, in C:\wamp\bin\php\php5.5.12\

  4. Add these lines to your cert in both php.ini files:

    curl.cainfo="C:/wamp/cacert.pem"openssl.cafile="C:/wamp/cacert.pem"
  5. Restart Wamp services.


Disclaimer: This code makes your server insecure.

I had the same problem in Mandrill.php file after line number 65 where it says $this->ch = curl_init();

Add following two lines:

curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);

This solved my problem and also sent email using localhost but I suggest to NOT use it on live version live. On your live server the code should work without this code.


Thanks @Mladen Janjetovic,

Your suggestion worked for me in mac with ampps installed.

Copied: http://curl.haxx.se/ca/cacert.pem

To: /Applications/AMPPS/extra/etc/openssl/certs/cacert.pem

And updated php.ini with that path and restarted Apache:

[curl]; A default value for the CURLOPT_CAINFO option. This is required to be an; absolute path.curl.cainfo="/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem"openssl.cafile="/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem"

And applied same setting in windows AMPPS installation and it worked perfectly in it too.

[curl]; A default value for the CURLOPT_CAINFO option. This is required to be an; absolute path.curl.cainfo="C:/Ampps/php/extras/ssl/cacert.pem"openssl.cafile="C:/Ampps/php/extras/ssl/cacert.pem"

:Same for wamp.

[curl]; A default value for the CURLOPT_CAINFO option. This is required to be an; absolute path.curl.cainfo="C:/wamp/bin/php/php5.6.16/extras/ssl/cacert.pem"openssl.cafile="C:/wamp/bin/php/php5.6.16/extras/ssl/cacert.pem"

If you are looking for generating new SSL certificate using SAN for localhost, steps on this post worked for me on Centos 7 / Vagrant / Chrome Browser.