PHP - SSL certificate error: unable to get local issuer certificate
Finally got this to work!
Download the certificate bundle.
Put it somewhere. In my case, that was
c:\wamp\
directory (if you are using Wamp 64 bit then it'sc:\wamp64\
).Enable
mod_ssl
in Apache andphp_openssl.dll
inphp.ini
(uncomment them by removing;
at the beginning). But be careful, my problem was that I had twophp.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, inC:\wamp\bin\php\php5.5.12\
Add these lines to your cert in both
php.ini
files:curl.cainfo="C:/wamp/cacert.pem"openssl.cafile="C:/wamp/cacert.pem"
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
.