Unable to Establish Secure Connection Error Fix

Seeing ‘Unable to establish secure connection error’ in WordPress? Learn how to fix secure connection error fast using the best solution

By Claudio Pires
Updated on November 13, 2022
Unable to Establish Secure Connection Error Fix

Are you seeing an ‘Unable to establish secure connection error’ in WordPress? It is a standard WordPress error and usually occurs when installing or updating a WordPress plugin or theme from the official WordPress.org directory. This article will show why this error occurs and how to fix secure connection error in WordPress quickly using the best solution.

WordPress errors are rare, but the platform is so popular that almost all of them are well-cataloged. For example, the WordPress secure connection error rarely pops up, 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 hard. 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 the WordPress secure connection error 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. Don’t hesitate to get in touch with 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 in a clue as to what’s wrong. The bad news is the advice it gives you on how to solve the error is rather lackluster. There are several ways to tackle this particular error, but first, let’s discuss some potential causes.

How To Solve The Bugs?

  • Your website is under a heavy load. For example, if you’re using shared hosting, 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. Sometimes, your website might try to connect to the wrong address instead of WordPress.org due to a misconfiguration.
  • A problem with your firewall.  Many 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 needed files. 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 it to say if the device isn’t there, your site won’t be able to establish the connection it needs. Follow this to fix the unable to establish a secure connection error and get the solution

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

4 Ways to Fix the WordPress Secure Connection Error

Before we go any further, you should know none of these fixes will work if you use 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 use shared hosting, your best bet is to contact your web host’s support team immediately so they can make the necessary adjustments.

In this section, we’ll deal with fixes that require you to tinker with how 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 must 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.

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 to fix the unable to establish secure connection error in WordPress and find the solution:

sudo nano /etc/hosts

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

The goal 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: 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:


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


If either of those lines is nowhere to be seen in php.ini, 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: Unable to Establish a Secure Connection Error Fix & WordPress Solution

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

If your server uses a firewall, you’ll want to ensure 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.

4 Fix WordPress secure connection error on localhost

If you’re running WordPress on your own computer (localhost), you probably don’t have the cURL extension enabled for PHP. This extension is required to visit WordPress.org for updates.

You need to edit the php.ini file on your computer. This file is usually located in the Mamp, Xampp, or WAMP folder’s PHP folder.

If you are using a Windows computer, look for the following line:


Mac and Linux users will need to look for this line:


Now you need to remove the semicolon in front of the text to enable expansion. Don’t forget to save your php.ini file.

Don’t forget to restart the Apache server for the changes to take effect.


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 an 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 a secure connection error in WordPress:

  1. Update your server’s host file.
  2. Check if the cURL extension is enabled for PHP.
  3. Check if the right ports are open on your firewall.
Claudio Pires

Claudio Pires is the co-founder of Visualmodo, a renowned company in web development and design. With over 15 years of experience, Claudio has honed his skills in content creation, web development support, and senior web designer. A trilingual expert fluent in English, Portuguese, and Spanish, he brings a global perspective to his work. Beyond his professional endeavors, Claudio is an active YouTuber, sharing his insights and expertise with a broader audience. Based in Brazil, Claudio continues to push the boundaries of web design and digital content, making him a pivotal figure in the industry.