SSL Error: unable to get local issuer certificate
An SSL certificate serves as a vital safeguard for securing the communication between a server and a browser, thwarting any unauthorized interception of sensitive data by third parties. It facilitates SSL/TLS encryption, encapsulating the website's public key and identity, while encompassing essential information for ensuring the integrity and authenticity of the website.
Reason for unable to get local issuer certificate
The SSL certificate serves a crucial role in verifying authentication and ensuring secure data exchange between the server and the client, achieved through the HTTPS protocol. During the SSL handshake, the client receives the server's certificate and its private key to establish the SSL connection. To ensure trust in the server's certificate and prevent man-in-the-middle attacks, the client must possess the CA certificate that signed the server certificate. However, in this case, the TLS server fails to send the complete certificate chain during the handshake, specifically omitting the intermediate certificate, which is essential according to standards.
Solution: Unable to get Local Issuer Certificate
The most effective solution to address this issue is to obtain a reliable SSL certificate from a trustworthy Certificate Authority (CA) and properly install it. However, it is essential for the server administrators to address the root cause of the problem, as this issue is related to the server setup. By rectifying the server configuration, the complete certificate chain, including the intermediate certificate, should be sent during the handshake, ensuring a secure and seamless SSL connection.
Change php.ini (Maintain SSL)
- Download cacert.pem from https://curl.haxx.se/ca/cacert.pem
- Then, copy cacert.pem into your version of zend/openssl.
For example, '/usr/local/openssl0.9.8/certs/cacert.pem'.
- Mdify the CURL configuration by adding:
"cainfo = '/usr/local/openssl-0.9.8/certs/cacert.pem'"
Without Altering php.ini file (Maintain SSL)
For .CRT Format
- Go for the SSL bundle – ca-bundle.crt
- You can acquire the SSL bundle by copying the below URL content on your server.
Different servers have different ways to restart PHP. After restarting PHP and see whether the CURL is able to read HTTPS URL or not.
To help Git find the CA bundle, use the below-mentioned command:
Use the following command to disable the verification of your SSL certificate :
If neither of the two options work, consider removing and reinstalling Git .
Disable SSL (Not advisable)
Disabling SSL certificate verification is a possible approach, but it should only be used for experimental purposes and never in a production environment. By disabling certificate verification, your program will bypass the standard SSL authentication process, which can potentially lead to security vulnerabilities and expose your system to potential threats. It is crucial to use this method with extreme caution and only for testing purposes, while ensuring that proper SSL certificate verification is enabled in a production setting to maintain a secure and trustworthy communication channel between the server and the client.
The SSL error "unable to get local issuer certificate" occurs when the server's certificate chain is not properly configured, and the client cannot verify the authenticity of the certificate. This error can be resolved by ensuring that the server's SSL certificate is purchased from a trusted Certificate Authority (CA) and properly installed, while also making sure the server's configuration includes the complete certificate chain to establish a secure SSL connection.