I receive the error "SSL certificate problem: unable to get local issuer certificate.", why? - Code Parrots

Knowledge Base

I receive the error “SSL certificate problem: unable to get local issuer certificate.”, why?

Article Last Updated: March 4, 2021

Error Message:

API call to helper/ping failed: SSL certificate problem: unable to get local issuer certificate.

Error Explination:

There are a number of reasons you might be seeing this error message. We will outline the two most common causes of this error and how to fix them:

Local Host Installations using MAMP/XAMPP etc.

Ways to fix this issue:
The most reasonable solution for a localhost install is to download a local copy of the necessary CA certs. Once downloaded you can add them to the necessary location and make changes to your localhost server config files to properly reference them.

1) Download cacert.pem file from here: http://curl.haxx.se/docs/caextract.html
2) Save the file in your PHP installation folder. (eg: If using xampp – save it in c:\Installation_Dir\xampp\php\cacert.pem).
3) Open your php.ini file and add this line:
4) curl.cainfo=”C:\Installation_Dir\xampp\php\cacert.pem”
4) Restart your Apache server and that should fix it (Simply stop and start the services as needed).

If the above steps are too complicated, see the snippet below for a quick alternative workaround.


Sites on Remote Hosts (Hostgator, Bluehost etc.)

The cURL extension (which is used by WordPress for remote communication) must be able to verify the SSL certificate for any remote site that Easy Forms for Mailchimp by YIKES connects to. If your copy of WordPress is not equipped with a root CA bundle that can perform a lookup on the SSL certificate for Mailchimp you will most likely run into problems.

Ways to fix this issue:
1) The first, and most successful, solution is to contact hosting company and request assistance. You can ask them to update the certificate bundle that your current WordPress installation is using, since it is most likely out of date.

2) Alternatively, you can disable SSL verification. Since version 6.0.3.1 of Easy forms for Mailchimp by YIKES we’ve included a custom action hook for users who are facing this issue.

Important: The following fix requires Easy Forms for Mailchimp by YIKES v6.0.3.1 or later.

Add the following snippet of code to the bottom of your functions.php file:

/*
*  Disable SSL Verify Host/SSL Verify Peer on CURL requests
*  only effects for Easy Forms for Mailchimp by YIKES
*/
function yikes_mailchimp_disable_ssl_verfiy_host_and_peer( $ch ) {
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
}
add_action( 'yikes-mailchimp-api-curl-request', 'yikes_mailchimp_disable_ssl_verfiy_host_and_peer' );

Please Read:

If you are on a live server, and the above did not help resolve the issue – the only other option is to reach out to your hosting provider. This is not something we are able to resolve, as it lies at the server level.