Are you seeing ‘Unable to establish secure connection error’ in WordPress? It is a common WordPress error and usually occurs when you are trying to install or update a WordPress plugin or theme from official WordPress.org directory. In this article, we will show you why this error occurs and how to easily fix secure connection error in WordPress.

WordPress errors are somewhat rare, but the platform is so popular that almost all of them are well-catalogued. For example, the WordPress secure connection error pops up rarely, but when it does, it can hinder you from installing new plugins and themes.

If you have full access to your server, fixing this error isn’t overly complicated. The only problem is, it can have more than one cause, so you may need to try a few things before you hit the jackpot. In this article, we’ll talk more about what the WordPress secure connection error is, and teach you multiple ways to fix it. Let’s get to it!

WordPress Secure Connection Error

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 this one:

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

Unlike other bugs such as the White Screen of Death, you’re given a clue as to what’s wrong. The bad news is the advice it gives you on how to solve the error is rather lacklustre. There are several ways to tackle this particular error, but first, let’s talk about some of its potential causes:

Your website is under a heavy load. If you’re using shared hosting, for example, a lot of traffic can cause a strain on your server’s resources. That strain can cause your connection requests to WordPress.org to time out.

If you’re using shared hosting, for example, a lot of traffic can cause a strain on your server’s resources. That strain can cause your connection requests to WordPress.org to time out. A misconfiguration in your server. In some cases, your website might try to connect to the wrong address instead of WordPress.org due to a misconfiguration.

In some cases, your website might try to connect to the wrong address instead of WordPress.org due to a misconfiguration. A problem with your firewall. A lot of modern web hosts implement a firewall system that blocks potential malicious connections. To do this, those firewalls often block entire ports as a precaution, and it might be they disabled the one your website needs.

A lot of modern web hosts implement a firewall system that blocks potential malicious connections. To do this, those firewalls often block entire ports as a precaution, and it might be they disabled the one your website needs. Your website can’t run the necessary script to get the files it needs. When your server tries to download a file from a remote source, it runs a command line tool called cURL. We’ll talk more about how it works later, but suffice to say, if the tool isn’t there your site won’t be able to establish the connection it needs.

In the next section, we’ll teach you how to troubleshoot most of those issues. However, if the source of the error is an abundance of traffic, you may want to consider waiting it out, upgrading your plan, or contacting your host to see if they can increase your server’s resources temporarily.

3 Ways to Fix the WordPress Secure Connection Error

Before we go any further, you should know none of these fixes will work if you’re using a shared hosting plan. This is because you’re not given full access to your server’s configuration, unlike options such as a Virtual Private Server (VPS) or dedicated server. If you do use shared hosting, your best bet is to contact your web host’s support team right away so they can make the necessary adjustments.

In this section, we’re going to deal with fixes that require you to tinker with the way your server works – don’t worry, we’ll explain everything step-by-step!

1. Update Your Server’s hosts file

One of the most efficient ways to connect to your server and manipulate your files is through Secure Shell Access (SSH). If you’re a Windows user, you need to use a tool such as PuTTy to access your server. On the other hand, macOS or Linux users can use whichever command line tool they want to.

Let’s proceed with the assumption you’re using Windows. Once you install PuTTy and run the tool, choose SSH as your Connection Type. For hostname, you’ll need to use the address your web host provides you:

On the next screen, you’ll need to log into your server via SSH using your server’s admin credentials. If you’re not sure what they are, try asking your provider’s support team:

Once you’re logged in, you’ll have full access to your server, so we can finally get to work by running this command:

sudo nano /etc/hosts

This simply uses the nano editor to open the host’s file, which is basically a list used to associate particular IP addresses with websites:

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 using nano:

66.155.40.202 api.wordpress.org

Once you save the changes to your host’s file, close it and return to your dashboard. Now try installing whichever plugin or theme gave you problems earlier. If the error persists, check out the other methods.

2. Check if the cURL Extension is Enabled for PHP

WordPress relies on PHP primarily, so if you don’t have the right version installed – or even some necessary extensions in place – it might not work as intended. With this in mind, cURL is a PHP extension that enables you to transfer files via the command line. To be more specific, you need cURL for WordPress to be able to download plugins from the official repository or update themes. Using SSH, 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

Keep in mind the line looks slightly different for macOS and Linux users:

;extension=curl.so

If either of those lines is nowhere to be seen in php.ini, go ahead and add them, just as you did with the previous method. Now save the changes to php.ini and restart your server. This will force the file to load again, at which point you should check if the error is gone.

3. Check if the Right Ports Are Open on Your Firewall

Whether your server uses a firewall out of the box depends mostly on the hosting service and plan you use. For example, if you’re using a VPS, you’ll probably need to set up and configure a firewall yourself.

If your server does use a firewall, you’ll want to make sure it doesn’t block the ports your web server software uses. By default, Apache and nginx use either port numbers 80 or 8080 – so those are the two you need to look out for.

Depending on your host, you may be able to configure your firewall directly from your control panel:

In any case, your best bet is to check out your hosting provider’s documentation. Inside, you should find information about the way they implement firewalls and if they do so in the first place. If that’s the case, there should be instructions on how to unblock pores.

Conclusion

As far as WordPress bugs go, the secure connection error is mostly harmless. You can still upload themes and plugins manually via FTP if needed. Still, it makes sense to fix it as soon as possible. After all, it points towards a problem with your server’s configuration, which could impact you in order way if not sorted.

If you’re using a host that provides you with full access to your server, here are three ways to fix the Unable to establish secure connection error in WordPress:

Update your server’s hosts file. Check if the cURL extension is enabled for PHP. Check if the right ports are open on your firewall.