How to Fix Secure Connection Error in WordPress

How to Fix Secure Connection Error in WordPress

In this tutorial, we will explain the meaning of Secure Connection Error in WordPress and why it happens and then explain some of the methods on how to fix Secure Connection Error in WordPress. WordPress is one of the most popular content management systems, used by millions of users around of the world. If you are a WordPress user, you may have come across some kind of WordPress related error while working on your site. One of the many WordPress errors that you may encounter is the Unable to establish secure connection error. Repairing the Secure Connection Error in WordPress is fairly easy task if you carefully follow the steps bellow.

1.Introduction

The WordPress secure connection error usually happens when you try to install or update a plugin or theme from the official WordPress.org database. Even if you don’t do this manually, your WordPress always checks if there are new updates available for your existing plugins, themes or WordPress core files. During this process, your server needs to connect to WordPress.org in order to check for any available updates. If your server cannot reach the WordPress.org server and establish a secure connection, then the following error will appear in your browser:

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 
/var/www/wordpress/wp-admin/includes/update.php on line 122

Now when we know what this error means and when it happens, let’s move on and take a look at the some of the possible solutions to fix this problem.

2. Server Related Issues

Depending on your hosting environment, there are few possible ways how to approach on solving this problem. If you are on a Shared Hosting server, it might be that the server is currently under heavy load or under a DDoS attack. This will most likely result in a timeout while trying to connect to the WordPress.org server resulting in the secure connection errors. If this is a case you can wait for some time to pass before trying again, or you can try to contact your hosting company so they can investigate the issue. This error can also happen as a result of some DNS related issue. f you have Virtual Private Server (VPS) and you have an SSH access to the server, you can try to fix this by editing your server’s host files. To do this, first, you need to connect to your server via SSH. Once you are successfully connected, you can execute the following command:

nano /etc/hosts

This will open the /etc/hosts file with the nano text editor. Place the following code at the end the file :

66.155.40.202 api.wordpress.org

Once you save the file, return to your WordPress admin and try to check for updates again and see if the Unable to establish secure connection error has been fixed.

3. cURL Extension for PHP

Since WordPress is written in PHP, it requires the correct version and extensions to be installed in order to function properly. In our case, in order for your WordPress site to be able to connect to WordPress.org and check and download the required updates or plugins, you will need to make sure that the cURL PHP extension is installed and enabled. For example, to install the cURL extension for PHP 7.0 on Ubuntu server you can use the following command:

apt-get install php7.0-curl

On CentOS you can do it by executing:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
yum install php7.0-curl

After you do this, make sure that you restart your web server (Apache or Nginx) with the following commands:

systemctl restart apache2

or

systemctl restart nginx

4. Check Your Firewall

If you have a Firewall service installed on your server you will need to check that the ports used by your web server are not blocked by any firewall rules. The default web server ports used by Apache or Nginx are 80 or 8080 for HTTP and/or 433 for HTTPS. If you are using the UFW firewall,  you can use the following commands to open these port numbers. For Apache:

ufw allow 'Apache Full'

For Nginx:

ufw allow 'Nginx Full'

You can then check the status of your firewall and verify that the changes are applied with the following command:

ufw status

You can now go back to your WordPress site and try to run the update check again to see if the secure connection error has been fixed.

5. Conclusion

Fix Secure Connection Error in WordPressIf you followed all the of instructions provided so far, troubleshooting and fixing the Secure Connection Error on your WordPress site should be a fairly easy task. Make sure you also check some of our other tutorials on how to fix other common WordPress errors such as the 500 Internal Server Error, 403 Forbidden ErrorError Establishing a Database Connection,  ERR_TOO_MANY_REDIRECTS and other HTTP WordPress errors. Fixing the Secure Connection Error on WordPress is an easy task if you have a WordPress Hosting with us. Feel free to ask our expert Linux Administrators to fix the Secure Connection Error error on WordPress for you, and it will be taken care of immediately. They are available 24×7, so you can get the help you need at any time. PS. Feel free to share this blog post on how to fix the Secure Connection Error on WordPress, if you liked it by using the social network shortcuts – you can also leave a comment instead, found under the share buttons.

Leave a Comment