How to Fix Secure Connection Error in WordPress

Fixing Secure Connection Error in WordPress

When configuring a new VPS some time we come across an issue in WordPress updates and adding new plugins. The error comes is  ” An unexpected error occurred. Something may be wrong with or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to Please contact your server administrator.) in /home/username/public_html/wp-admin/includes/update.php on line 122 ” . There are multiple ways to fix this unexpected secure connection error in WordPress. We can try this following solutions based on your situation.

It is mostly a hosting and server related issues

Some time if your shared hosting server is under DDoS attack, then it is likely that the connection to will timeout causing the secure connection error.

In that case, you can wait for a few minutes and try again. If the error persists, then you need to reach out to your web hosting company’s support team.

Cloud or VPS Server Connectivity Issue

If you are on a cloud or VPS hosting, then it is possible that your server is unable to connect to due to some DNS issues.

In that case, you can point your server directly to servers. You will need to connect to your server using SSH.

SSH is short for secure shell which is very useful and is an encrypted protocol that allows you to connect to your server using command line tools and help to manage the server.

We can access server via SSH using PuTTy in Windows PC whereas Mac / Linux users can use the terminal app to access SSH.

For this we need login credentials for the account with shell access to your hosting account.

In Mac/Linux terminal, you can connect to your server like this:

Here don’t forget to replace username with your own username and with your own domain name.

Once you are connected to the server, you need to run the following command:

sudo nano /etc/hosts

This will open hosts file in editor window, and now we need to add the following code at the bottom of the file:

Above IP is for, always check it before using, as there may be change in this IP some time. So better to just ping and check if it is resolving to this IP. Now  save this file by pressing Ctrl + X on your keyboard.

You’ll now be asked if you want to save your changes to the file, press “Y” and hit enter.

Next, you’ll be asked to give a name to the file, here just hit enter on your keyboard.

Now save the file You can now save your changes and exit the the editor.

Great you have fixed the error. Visit your website to see if this resolved the error.

If issue still not fixed then 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 you don’t find these line 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,  Now check if the error is fixed. Firewall needs to be checked if it is blocking the ports which are used by web server software. By default, Apache and nginx use either port numbers 80 or 8080 – so those are the two ports should not be blocked by firewall.
Now check the error should be fixed. Great job done.

Share on: Share YogiRaj B.Ed Study Notes on twitter Share YogiRaj B.Ed Study Notes on facebook Share YogiRaj B.Ed Study Notes on WhatsApp

Related Posts

Right to assemble as per constitution of India

Right to assemble
Article 19(1)(b) in constitution of India provide that all citizens of India have the right to assemble peaceably and without arms. The right of assembly includes the right to hold meetings and to take out processions.

Read full article
Advanced Organiser Model and its education implication

If we connect new information/knowledge to previous knowledge then it helps to understand easily and also to remember for a long time. To prevent introduction in terms of statement or to present material before teaching a lesson is called ‘Advanced Organizer’.

Read full article

Some important study notes