How To Fix Secure Connection Error In WordPress

Have you ever faced a ‘Unable to establish secure connection error’ while installing WordPress plugin or updating themes from WordPress.org directory ?

The WordPress secure connection error usually occurs when you’re trying to install or update plugins and themes from WordPress.org.

If you ever run into it, you’ll see a message much like the one below. Due to the incorrect config, it fails to connect to the WordPress.org website.

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 117

The above is a message you will get if you are unable to establish a secure connection error.

Step 1:

There are different situations where you can encounter this error. It may occur if your hosting server is under DDOS attack. During such attacks, the connection with wordpress.org will possibly timeout causing the secure connection error.

This issue usually solves itself after some time of the attack. If the error continues, you need to contact your web hosting support team.

How To Fix Secure Connection Error In WordPress

Step 2:

This issue is also likely to occur if your website is on cloud or VPS hosting due to DNS issues. To fix this, you need to connect to your server using SSH. After connecting to your server, you need to open the Hosts file.

In Windows, you can use a Putty app whereas Mac Users can use the terminal to connect to their server.

ssh test@example.com
#for mac users

Here, test is the username and example.com is the domain name. After connecting to the server, you can open the hosts file using the following command

sudo nano /etc/hosts

Step 3:

In your hosts file, you need to hardcode the IP address of the wordpress.org.

66.155.40.202 api.wordpress.org

The goal here is to ensure your hosts file is mapping WordPress.org to the correct IP address. To do that, we’re going to add an extra line to the file.
Save your hosts file and exit the editor. Now you can visit the website and see if the problem has been fixed or not.

Step 4:

You can also face this issue if your server uses a firewall. If it does, you need to make sure it doesn’t block the ports used by the apps. Usually, Apache nginx use port 80 or 8080.

Step 5:

WordPress is built on PHP, so if you don’t have the correct version installed or some unnecessary extensions in place, it might not work as expected. cURL is a PHP extension that enables you to transfer files using the command line. You need cURL for WordPress to be able to download plugins from the official repository or update themes. Using SSH, you can execute the following command:

sudo nano
/etc/php.ini

If you’re a Windows user, look for the following line within the file:

;extension=php_curl.dll

The line looks slightly different for Linux users:

;extension=curl.so

If these lines are not present in php.ini, add them. Now save the changes to php.ini and restart your server. This will force the file to load again, removing the error.

Conclusion

By checking the above methods, you can now successfully resolve the “Unable to establish secure connection” error in your WordPress website.

Check out these top 3 WordPress hosting services:

Was this article helpful?