Error: WordPress could not establish a secure connection to WordPress.org

Last updated on 06 Sep 2023, 13:13:55.
Category: All about web hosting | Webhosting settings

IPv6 Linux Wordpress

This article describes a problem with Wordpress 4.9.1+ where it is not possible to install custom plugins or themes through the Wordpress dashboard.

Secure connection?

At first sight, it seems the Wordpress installation failed, or there is a problem with the hosting itself.
If you take a closer look, Wordpress uses cURL to connect to the api.wordpress.org server, behind the scenes.
Even if you try to establish the connection (through SSH) from the server, there seems to be no issue, the server can be reached.
If you execute a manual cURL call:

curl api.wordpress.org

You can connect...
On the other hand, if you tend to use IPv6 to connect:

curl -6 api.wordpress.org 

You might get an error. So, let's fix the IPv6 problem shall we? Not really... setting your server on IPv6 may not fix the problem.
But, it helps us in understanding the "why" of the error.
The problem seems to be related on hostname resolving, of some sort.

Workaround

The only way to get around the problem is by adjusting a Wordpress core file. Sure it is NOT DONE, and by updating this file you break the updates in the future, but at least you can continue with your work!

By the time of this writing (07.12.2017) there was no fix yet for the connection problem, so for now this is the only "easy" solution.

Writing a custom action or plugin won't really help either since it is a core functionality within Wordpress.

Modify the wp-includes/Requests/Transport/cURL.php file and add the following line (at line 97):

curl_setopt($this->handle, CURLOPT_RESOLVE, array("api.wordpress.org:80:66.155.40.187", "api.wordpress.org:443:66.155.40.187", "downloads.wordpress.org:80:66.155.40.203", "downloads.wordpress.org:443:66.155.40.203"));

This is a temporary solution, but at least it helps you to continue installing plugins etc...


Related articles

Kinamo mail server settings (mail server cheat sheet)

The following article provides the basic settings and server names (domain names) for the Kinamo mail infrastructure. These settings allow...

Read more

Create an automatic SPAM filter in the Kinamo Webmail

This article explains how you may create a filter that will automatically place SPAM messages in a special folder, so...

Read more

Order an SSL certificate? What is an SSL certificate?

You need to order an SSL certificate? But what is an SSL certificate? And why is everyone saying that it...

Read more

Need extra help?

Were not all your questions answered?
Don't worry, we will be happy to help you via a support request!

Select your language

All languages: