SSL Error: unable to get local issuer certificate

SSL certificate protects the communication exchanged between the server and the browser , which prevents data interception of a third party. It makes SSL/TLS encryption possible, and they contain the website's public key and the website's identity, along with related information.

how to solve unable to get local issuer certificate

Reason for unable to get local issuer certificate

Your SSL certificate's primary purpose is to confirm authentication and ensure a secure exchange of information between the server and the client by referring the HTTPS protocol. When you connect to the web-server to establish SSL connection you as a client get server's certificate in the handshake. This certificate and its private key are used to establish the SSL connection. Client wants to ensure that the server's certificate is trusted and is not created by some man-in-the middle attacker. So, Client need to have the CA certificate that signed the server certificate. The problem here is that this TLS server doesn't send a complete cert chain in the handshake, which it should according to standards. More specifically, it doesn't send the intermediate certificate.

Solution: Unable to get Local Issuer Certificate

The best solution is to purchase the SSL certificate from a trustworthy CA and install the same. The real and proper fix should be done by the server admins because this is a server setup problem.

Change php.ini (Maintain SSL)

  1. Download cacert.pem from
  2. Then, copy cacert.pem into your version of zend/openssl.
    For example, '/usr/local/openssl0.9.8/certs/cacert.pem'.
  3. Mdify the CURL configuration by adding:
    "cainfo = '/usr/local/openssl-0.9.8/certs/cacert.pem'"

Without Altering php.ini file (Maintain SSL)

$ch = curl_init(); $certificate_location = '/usr/local/openssl-0.9.8/certs/cacert.pem'; curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $certificate_location); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $certificate_location);

For .CRT Format

  1. Go for the SSL bundle – ca-bundle.crt
  2. You can acquire the SSL bundle by copying the below URL content on your server.

Restart PHP

Different servers have different ways to restart PHP. After restarting PHP and see whether the CURL is able to read HTTPS URL or not.

Git Users

To help Git find the CA bundle, use the below-mentioned command:

git config –system http.sslCAPath /absolute/path/to/git/certificates

Temporary Fix

Use the following command to disable the verification of your SSL certificate :

git config –global http.sslVerify false

If neither of the two options work, consider removing and reinstalling Git .

how to fix SSL Error: unable to get local issuer certificate

Disable SSL (Not advisable)

$ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

This is essentially disabling SSL verification . You can disable certificate verification completely which then will allow your program to continue. Only do that for experiments, never for production.