cURL error 28: Connection timed out after X milliseconds: how to repair

  • Post category:errors
  • Post comments:0 Comments

Is your WordPress site showing the cURL error 28: Connection timed out error?

The cURL error 28 is a common WordPress REST API problem that can degrade the performance of your website and cause it to behave in unpredictable ways.

We’ll show you how to quickly resolve the ‘cURL error 28: Connection timed out’ issue on your WordPress website in this article.

Contents

In WordPress, what is cURL?

WordPress and many other online applications use the cURL software utility to send and receive data requests via URLs.

Several API queries are handled by WordPress using cURL. It’s an extension of the PHP programming language, and your WordPress hosting provider will take care of it.

The cURL library is essential to how WordPress functions behind the scenes. Your WordPress website will not function correctly if it is not configured properly.

What Causes WordPress’s cURL Error 28?

cURL error 28 occurs when WordPress fails to respond to the server’s data requests in a timely manner.

To transmit and receive data requests, WordPress employs the REST API (a programming approach). If these requests fail, the Site Health report will show a major issue with the heading ‘The REST API encountered an error.’

When you expand the error, you’ll get more information, including the error message:

cURL error 28: Operation timed out with x bytes received (http_ request failed) after x milliseconds.

Another issue with the title ‘Your site could not finish a loopback request’ may also be present. The error notice will be similar to the one below, with the following description.

‘The loopback request to your site failed, which means that features that rely on them aren’t working right now.’

What could cause a cURL timeout?

In WordPress, there are a number of conditions that can cause the cURL to time out.

A WordPress firewall plugin, for example, may block a REST API request if it is deemed suspicious.

If your DNS server isn’t working properly, HTTP requests may fail, resulting in the cURL timeout error in WordPress.

A WordPress hosting server with a faulty configuration may simply have an extremely low timeout threshold, preventing certain WordPress operations from running properly.

With that in mind, let’s look at how to troubleshoot and resolve the ‘curl error 28: Connection timed out’ problem in WordPress.

1. Disable the WordPress Firewall for the time being.

If you’re using a WordPress firewall or security plugin, deactivate it for the time being.

Then, to see if your problem has been resolved, go to the WordPress site health report page.

If that’s the case, look through your WordPress firewall logs to determine which API requests were denied.

This will either pinpoint the cause of the problem or allow you to alter your firewall settings so that genuine API requests are not blocked.

2. Turn off all WordPress plugins.

To send and receive data, WordPress plugins use their own API queries. The cURL error in your site health report may occur if these calls are made too frequently or take too long to complete.

Deactivating all WordPress plugins is the simplest way to figure this out. Simply pick all plugins from the Plugins » Installed Plugins page.

After that, pick ‘Deactivate’ from the Bulk Actions drop-down menu, and then click the ‘Apply’ button.

To see if the problem has been resolved, go to the Site Health report. If this fixes the problem, you can start activating your plugins one at a time until the problem reappears.

This will assist you in identifying the plugin that may be causing the problem, and you can then seek assistance from the plugin author.

Check to see if your hosting server is using the most recent software.

Next, verify that your WordPress hosting server is running the most recent versions of PHP, the cURL library, and OpenSSL.

You may check this by going to the Tools » Site Health page and looking at the system information tab.

To expand the ‘Server’ area, go to the ‘Info’ tab and expand the ‘Server’ section. You may acquire information about the software installed on your WordPress hosting server from this page.

PHP 7.4.13 or above, curl 7.74.0 or higher, and OpenSSL 1.1.1 or higher should all be used on your server.

If it doesn’t, you’ll need to contact your WordPress hosting company and ask them to upgrade your account’s software.

Fix SSL Content That Isn’t Secure

If your WordPress site is using HTTPS / SSL, but it isn’t configured correctly, your web server can prevent unsafe cURL requests.

Similarly, if your WordPress site does not use HTTPS / SSL but performed an API call using an HTTPs URL, those requests will fail as well, and you may instead encounter the following cURL error:

‘Error: cURL error 7: Connection rejected (http_ request failed) when connecting to localhost port 443

To fix this, contact your hosting provider and request that your SSL certificate is reinstalled. If the problem persists, use our tutorial to fix common SSL difficulties to properly set up SSL on your WordPress site.

5. Seek assistance from a hosting company.

If the preceding measures don’t work to fix the cURL error 28 on your WordPress site, the issue is most likely related to your hosting environment.

Many issues are under your hosting company’s control and can only be rectified by them. If their DNS servers, for example, are unable to resolve queries in a timely manner, cURL requests will timeout.

Another possibility is that your hosting server is experiencing slower connectivity or networking troubles.

Simply submit a support ticket with the details of the mistake, and their technical team will troubleshoot and apply a remedy to resolve it.

We hope that this post has shown you how to resolve the cURL error 28 in WordPress.

Leave a Reply