Why error with cURL error 28: Operation timed out ?

Your website is up to date, functional, everything is well.

But one morning you have the following error:

cURL error 28: Operation timed out

… with various information, particularly in relation to the timeout.

Why this error ?

The problem may not necessarily come from your WordPress installation, but from the server that hosts your site.

We will list some possible causes below:

Server side:

  • Your server is not up to date with PHP and its libraries.
  • You encounter in memory overflow
  • Your cURL cannot reach the destination URL
  • You have a server firewall blocking incoming / outgoing requests

WordPress side :

  • You use a specific plugin with cURL having a time out set too low
  • You have installed or updated a security plugin that may cause a malfunction.

The solution

We will try to see point by point which solutions are possible according to the causes stated above.

On the server side :

  • Check on your hosting the version of PHP. It is advisable to have a PHP version as stable and as up to date as possible, in adequacy with your WordPress installation (which naturally must be up to date as well). You should, depending on the hosting provider, be able to get your PHP version up quickly and manually.
  • If not, contact your webhost to see if there is a need to upgrade your PHP version.
  • You are experiencing a memory overflow: we have already mentioned this problem in another article on our site, there are some settings that can be corrected if necessary:

memory_limit

max_execution_time

max_input_time

or, depending on the error you’ve identified:

upload_max_size

post_max_size

upload_max_filesize

  • If your cURL is unable to reach the destination URL, then you have to check several points: already, the target: is it reachable, does it answer correctly? If you go through a domain name, does the DNS server answer with the right IP address? If everything is correct, you will then have to check if you do not have the elements we will see in the following point
  • A firewall blocks some requests: this can happen, a banned IP, strict rules filtering incoming and/or outgoing requests… your cURL may fail if too restrictive security measures are in place. You will certainly have to check with your web host to see if everything is correct on their side to both ensure the security of your hosting, while allowing your cURL to work. Note that the same problem may in some cases be on the side of your destination.

WordPress side :

  • You are using a specific plugin with cURL with a time out set too low: some plugins offer to set the “timeout“, the maximum allowed duration of a script for example. If this timeout is too low, it is possible that the request initiated by cURL is too long and is therefore interrupted because the timeout is exceeded. So if you go through a plugin, the first thing to do is to check if there is a setting on this subject
  • You have installed or updated a security plugin that may cause a malfunction: some security plugins, if badly (or too well) set, may prevent cURL from working properly. Check your security settings or temporarily disable your security plugin to see if it’s blocking your requests.
Leave a Comment

Your email address will not be published.

You may also like