Fixing cURL Error 28: Connection Timed Out After X Milliseconds

cURL Error 28

Dealing with the “cURL error 28: Connection timed out” on your WordPress site can be frustrating. This error occurs when a request from your site takes too long to receive a response, resulting in a timeout. This can lead to your website slowing down and negatively impacting the user experience.

Luckily, there are several methods for troubleshooting and resolving this issue. This article will clarify cURL error 28, explain why it happens, and offer simple steps to fix and prevent it.

What is cURL Error 28?

cURL is a software utility WordPress uses to transfer data using various protocols. The “cURL error 28: Connection timed out after X milliseconds” occurs when a cURL request fails to complete within the specified timeout period. This error indicates that the server couldn’t respond quickly, leading to a timeout.

What is cURL Error 28 and how it works

Common Reasons for cURL Error 28

  • Network Congestion: Heavy traffic or network issues can delay responses.
  • Overloaded Server: The remote server might be handling too many requests.
  • Resource Constraints: Limited hosting server resources can slow response times.
  • DNS Issues: Problems with DNS resolution can cause delays.
  • Plugin or Theme Conflicts: Faulty plugins or themes can interfere with cURL requests.
  • SSL Configuration Issues: Improper SSL setup can block cURL requests.

6 Methods to Fix Curl Error 28: Connection Timed Out After X Milliseconds

  1. Disabling Security Plugin Firewall
  2. Deactivate Conflicting Plugins
  3. Resolve SSL Insecure Content Issues
  4. Check Your cURL Version
  5. Increase PHP Memory Limit
  6. Get Help from Your Web Hosting Provider

Note: It’s a good idea to back up your website before you make any changes. If something goes wrong, you can quickly restore your site to its previous state. You can use WP Staging for easy automatic backups. Check out the backup and restore guide for more help.

1. Disabling Security Plugin Firewall

A firewall plugin in WordPress adds an extra layer of security by blocking harmful traffic. However, sometimes, it can be overly cautious and block legitimate cURL requests, leading to the “Operation Timed Out” error.

To see if your security plugin is causing the issue:

  • Disable the Firewall: Turn off the firewall feature in your security plugin or deactivate the plugin.
Disabling Security Plugin Firewall to fix cURL Error 28
  • Test the Site: Check if the error persists after turning off the firewall.
  • Reactivate the Firewall: Turn the firewall back on after a short wait.
Reactivate Wordfence Plugin to test if the error is fixed
  • Try a Different Security Plugin: If the error returns, consider using a different security plugin or contact the plugin’s support for help. Some plugins may require you to add their IP addresses to your allowlist to prevent legitimate requests from being blocked.

Following these steps, you can identify if your firewall is causing the cURL error and keep your site secure without blocking necessary data.

2. Deactivate Conflicting Plugins

When you experience issues or conflicts with specific plugins on your WordPress website, it may be necessary to disable them temporarily.

By deactivating all plugins, you can isolate and troubleshoot the problem without affecting your website’s overall functionality.

Here’s how to do it:

  • Access your WordPress admin dashboard by logging in to your site.
  • Go to “Plugins” from the sidebar menu and click on it. You will see a list of installed plugins.
check installed plugins
  • Select the plugins you want to disable by clicking the checkboxes next to their names. You can choose multiple plugins at once.
troubleshoot cURL Error 28 by checking plugin updates
  • Once you have selected the plugins, look for the “Bulk Actions” dropdown menu at the top of the list and select “Deactivate”.
  • Click the “Apply” button next to the dropdown menu.
deactivate plugins to troubleshoot cURL Error 28

After deactivating plugins, refresh your website to see if updates instantly appear. Then, reactivate plugins one by one, refreshing your site each time to pinpoint the problematic one.

Repeat this process until you find the culprit, and consider updating, replacing, or contacting the plugin developer for help.

3. Resolve SSL Insecure Content Issues

An SSL certificate (Secure Sockets Layer) is essential for securing data between your website and visitors. It ensures that all data transmitted is encrypted, preventing unauthorized access and boosting trust in your site.

Properly implementing SSL lets your website use the HTTPS protocol, safeguarding the connection between your server and users’ browsers.

Check SSL Status in Hostinger Provider Dashboard:

Log in to your hosting provider’s dashboard (e.g., Hostinger) to verify the status of your SSL certificate. Ensure it is active and correctly configured, as shown in the image below:

check SSL status in hostinger for cURL Error 28

4. Check Your cURL Version

  • Navigate to the Site Health page on your WordPress dashboard.
  • Select the ‘Info’ tab and find the ‘Server’ section.
  • Look for the PHP and cURL version information listed there.
check site health for cURL error 28

Match Your cURL and PHP Versions for Better Performance: To ensure smooth operation, make sure your cURL version matches the requirements for your PHP version.

For instance, if your site uses PHP 8.1, you should have at least cURL 7.2.

check cURL version to fix cURL error 28

5. Increase PHP Memory Limit

WordPress plugins require cURL requests for many functions, which can consume a lot of memory, especially with extensive data or complex tasks. If the memory or time limits are too low, you might see errors like cURL error 28, indicating a timeout.

To prevent these issues, check and adjust your server’s PHP limits through the Site Health page. You can also increase these settings in the .htaccess or wp-config.php file to improve your site’s performance and avoid timeouts.

Use an FTP client like FileZilla or your web host’s file manager to access your WordPress root directory.

navigate to file manager in your hosting

Locate the wp-config.php file, right-click, and choose the ‘Edit’ option.

locate wp-config.php file cURL error 28

Add the following line of code before the line that says /* That's all, stop editing! Happy blogging. */, then click the ‘Save Changes’ button.

PHP
define('WP_MEMORY_LIMIT', '256M');
increase php limit to fix cURL error 28

6. Get Help from Your Web Hosting Provider

If you’ve tried everything and are still facing issues, it’s time to contact your hosting provider for help. They can look into other potential causes of the problem, such as conflicts in security modules or server settings.

Conclusion

The key steps for resolving cURL error 28 include temporarily turning off the WordPress firewall and deactivating plugins to check for conflicts. Additionally, it’s essential to review SSL configurations and ensure that server resource limits are sufficient.

Keeping WordPress and plugins updated is crucial for preventing such errors. If the issue persists, it is recommended that you seek assistance from your web hosting provider.