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

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

What are root and intermediate SSL certificates?

Root and intermediate SSL certificates are components of the Public Key Infrastructure (PKI) that are used to enable secure communication...

Read more

Keytool - Install SSL Certificate

This article assumes you've received your certificate from the Certificate Authority, and that you wish to install it on your...

Read more

Keytool - Generate SSL certificate request (CSR)

Keytool is a command-line utility that allows you to manage keystores, public and private keys, and SSL certificates for Java-based...

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!

Kinamo

Select your language

All languages: