If you face ‘Unable to establish secure connection error’ in WordPress then you can follow the article given in below to solve the problem. It usually occurs when you are trying to install or update a WordPress plugin or theme from official WordPress.org directory. It is also a common WordPress error. In this article, we will show you why this error occurs and how to easily fix the secure connection error in WordPress.
What causes Unable to Establish Secure Connection Error in WordPress?
WordPress comes with built-in features which help you to manage your updates. This system is checked regularly for the reason for updates and notifications showing for you to install plugin/theme updates.
However, Connection to the WordPress.org website is necessary in order to check for updates or install them. A misconfiguration on your WordPress hosting server is responsible, for your website. It may fail to connect with WordPress.org website.
This will be the result which is in the secure connection error, and you will see an error message like this:
An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /home/username/public_html/wp-admin/includes/update.php on line 122
Let’s see how to easily fix secure connection error in WordPress.
Fixing Secure Connection Error in WordPress
There are different ways to fix the unexpected secure connection error which occurs in WordPress. You can follow one of the following solutions from given steps based on your situation.
Hosting and Server Related Issues
If you face your shared hosting server is under DDoS attack , then it is likely that the connection to WordPress.org will timeout causing the secure connection error.
In that case, you will wait for a few minutes and try again.If the error insists, then you need to reach out to your web hosting company’s team that supports you.
Cloud or VPS Server Connectivity Issue
When you are on a cloud or VPS hosting , then it is possible that your server is unable to connect to WordPress.org due to some DNS issues.
In that case, you directly point your server to WordPress.org servers.By using SSH You will need to connect to your server.
SSH is short for encrypted protocol secure shell that allows you to connect to your server using command line tools.
Windows users use a tool called PuTTy whereas Mac / Linux users can use the terminal app.
You will need login firstly to credentials for the account with shell access to your hosting account. You can get this information from your hosting account’s cPanel dashboard.If you don’t get then ask your web hosting server provider.
In the terminal, you can connect to your server like this:
Don’t forget to replace username with your own username and example.com with your own domain name.
If connected, you need to run the following command:
sudo nano /etc/hosts
This will open a file, and you will need to add the following code at the bottom of the file:
Now save your changes and exit the the editor. Visit your website to see if this resolved the error.
Fixing the WordPress Secure Connection Error in Localhost
If you are running WordPress on your own computer (localhost), then you may not have cURL extension which is enable for PHP. This extension is required to access WordPress.org for updates.
You will need to edit the php.ini file on your computer. You can see the file in the PHP folder of your Mamp, Xampp, or WAMP folder.
If you are on a Windows computer, then look for the following line:
Mac and Linux users would have to look for this line:
Now you need to remove the semicolon before the text to enable the extension. Don’t forget to save your php.ini file.
Lastly, don’t forget to restart the Apache server for changes to take affect.
Check Open Ports in FireWall
If cURL extension is properly installed on your local server, then in the next step you need to check your internet connection firewall.
Your computer’s firewall may be blocking outgoing connections from local server to WordPress.org. If you are on Windows, then press the start button and search for Windows Firewall.The users who uses Mac can find firewall settings in System Preferences » Security & Privacy
Now,You need to add Apache to your firewall’s allowed programs and allow both incoming and outgoing connections.
Now, restart Apache for changes to take effect
We hope this article will help you to solve the WordPress secure connection error.