Are you facing the error “SSL certificate problem: unable to get local issuer certificate”? Let’s see the reasons for the warning and how to fix it.
If you are a regular internet user, then you must be aware of the term “SSL Connection” errors. This error usually comes up while browsing websites and stops users from accessing the website from a particular browser. This error is not limited to any website or browser. You might notice this error on Chrome, Opera, Firefox, and any other browser.
SSL certification errors occur while you are trying to connect to an SSL enabled website, and your browser is unable to establish a secure connection with the website server. When you are browsing several websites, you get a warning message such as “Your connection is not private” or else “ this connection is unsecured”.
As per the recent statistics, more than 30-35% of current websites use an SSL certificate to establish an authentic and secure exchange of information between the server and client. We often get messages while browsing certain sites such as “SSL Certification error”. You need to fix this error because your SSL certificate makes communication secure between the server and browser, which prevents data violation.
Here we are going to discuss what is SSL certificate, the prime cause for “SSL certificate problem: unable to get local issuer certificate” error, and how to fix the error.
What is an SSL Certificate?
SSL stands for Secure Sockets Layer designed to establish secure communication between a server and a web browser. SSL/TLS certificate is a digital certificate that comes with a cryptography key to protect online communications.
If your website is SSL protected, you may see https:// in the address bar with a green padlock or a combination of three.
There are several reasons for SSL error occurrence such as,
- An issue with date and time
- SSL certification expired
- SSL certificate is not installed correctly
- The site uses a self-signed certificate
- Mixed content error
The main object of the SSL certificate is to confirm a website authentication and secure the information exchanged between the server and browser.
Reason for “Unable To Get Local Issuer Certificate” Error
The error “SSL certificate problem: Unable to get local issuer certificate” appears due to the root certificate doesn’t working correctly. While you are trying to make a HTTPS request by using a client SSL, it is required to share your certificate for the identity verification process. At that time, it is essential that your root certificate is working properly.
Solutions to fix “Unable To Get Local Issuer Certificate” Error
We have mentioned earlier the causes for the inability to get a local issuer certificate error; now it’s time to fix it with the best possible solutions. You could be facing this error due to many reasons, and those reasons could vary. Once you identify the reason, it would become easier to fix it. Here we have mentioned several solutions that might help you fix the error.
# Solution 1: Alter the php.ini File
This is another way you can fix an SSL certification error by following some simple steps. Log in to your web control panel like cPanel and click on the file manager. Here you will find the PHP software, inside that you will see the file name php.ini, you need to edit this file by following the below-mentioned steps.
- Click on http://curl.haxx.se/ca/cacert.pem and download the same file.
- Once you are done with that, copy the cacert. pem to openssl. zend.
- Navigate to the php.ini file.
- Modify CURL.Add“cainfo= ‘/usr/local/openssl-0.9.8/certs/cacert.pem’” to edit it.
- After doing this, restart PHP.
- Confirm if CURL can now read the HTTPS URL.
Moreover, each server might vary on different browsers, but you need to restart PHP for this change to be updated. If you are using shared hosting, then it might be difficult to edit this file.
Once you are done with the above-mentioned steps, restart PHP. After restarting it, re-check your CURL request and confirm the error is solved or not.
# Solution 2: Don’t Change php.ini (Maintain SSL)
Enter the following code:
$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);
# Solution 3: Disable SSL (Not Recommended)
Enter the following code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
Today, small, medium and large-scale organizations are using SSL certificates to establish a secure connection between the web browser and server. Even all mobile browsers, web browsers, and various operating systems now supporting SSL certificates and their attributes. To resolve any SSL errors, you need to understand the reasons of error you are getting.