MailChimp API V2.0 SSL error solution
I got this SSL error while trying to use MailChimp API V2.0 in my localhost.
To resolve this, you can try any of the methods below.
Method 1:
If you are unable to edit php.ini file, there is a quick workaround.
Both methods should work but method 1 is probably more reliable.
Fatal error: Uncaught exception 'Mailchimp_HttpError' with message 'API call to lists/list failed: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' in C:\Installation\xampp\htdocs\mailchimp-test\Mailchimp.php:192 Stack trace: #0 C:\Installation\xampp\htdocs\mailchimp-test\mailchimp-api.php(16): Mailchimp->call('lists/list', Array) #1 {main} thrown in C:\Installation\xampp\htdocs\mailchimp-test\Mailchimp.php on line 192
To resolve this, you can try any of the methods below.
Method 1:
- Download cacert.pem file from here: http://curl.haxx.se/docs/caextract.html
- Save the file in your PHP installation folder. I am using xampp. So I saved it in
C:\Installation\xampp\php\cacert.pem
- Open your php.ini file and add this line:
curl.cainfo="C:\Installation\xampp\php\cacert.pem"
- Restart your Apache server and that should fix it.
If you are unable to edit php.ini file, there is a quick workaround.
- Open the MailChimp API file (it's most likely named Mailchimp.php or MailChimp.class.php).
- Look for statements starting with "curl_setopt".
- Right below the set of "curl_setopt" statements, add this line:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
method 1 worked for me, thanks
ReplyDeleteFreaking fantastic, worked like a charm.
ReplyDeleteThanks!
Awesome, #2 worked for me! Thank you :)
ReplyDeleteThis can be done without editing the wrapper class file.
ReplyDeleteJust pass an argument while initializing the Mailchimp class.
$mailchimp_obj = new Mailchimp ( 'YOUR_API_KEY', array('ssl_verifypeer' => false) );
Haven't tried this. If this works, that's great! Thanks for sharing.
DeleteYes, setting ssl false, worked for me. Thank you :)
DeleteYes, setting ssl to false, worked for me. Thanks :)
DeleteMethod 2 didn't work, so I tried first one for local machine - and it worked.
ReplyDeleteHope, it will work after deploy :)
I got this error only when working in the localhost. In the remote server, it wasn't an issue. Let me know if yours still continue to work after the deployment.
DeleteDoes anyone know how to setup the correct paths.
ReplyDeleteAll my links point to the root's www but i installed it in http://M.Y.I.P/mcapi2-php-examples/ , but the links goto http://M.Y.I.P/
Not sure if I understand completely.
DeleteHowever in your .htaccess, try this:
RewriteEngine On
RewriteBase /mcapi2-php-examples/
Perfect! Nr. 1 worked for me.
ReplyDeleteThank you very much!
Have a nice time :-)
Thats an excellent tip. Tip 2 worked for me.
ReplyDeleteHow do you fixed in wordpress because it dont have these folders you mentioned above
ReplyDeleteThank you very much, method 2 worked for me, i just had to make a small change for the v 2.0:
ReplyDeleteInstead:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Use this:
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
Thanks!, The second method work for me :D
ReplyDeletenon of them worked for me :(
ReplyDeleteIn Mailchimp.php there is curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
& I set FALSE but still showing:
API call to lists/list failed: SSL certificate problem: unable to get local issuer certificate
Nice. #2 worked.
ReplyDeletethanks both methods worked for me
ReplyDeleteThanks, i spent so many hours but no luck. Thank you very much!
ReplyDeleteIts helped me a lot :) Thanks
ReplyDeletewow It worked. Ohhh man you helped me so much. God bless you
ReplyDeleteThanks Method 2 worked for me :)
ReplyDeleteFree SSL ought to not be used for protected payments.
ReplyDelete