How to Fix “cURL Error 28” on WordPress Websites

How to Fix “cURL Error 28” on WordPress Websites

cURL Error 28 is a common error that can occur on WordPress sites. It’s related to the communication between your WordPress site and other external servers, such as API services, payment gateways, or email services, OR it’s a type of HTTP error that occurs when WordPress is unable to connect to another website or server. This error is also known as the “Operation timed out” error, and it indicates that the request made by WordPress to the server did not receive a response within the specified time limit.

When WordPress encounters a cURL error 28, it may cause issues with various functionalities on the website. For example, WordPress may not be able to update plugins or themes, or may not be able to retrieve data from external sources like RSS feeds or APIs.

There are several possible reasons for this error, such as network connectivity issues, server downtime, or problems with the server’s firewall or security settings. To resolve this issue, WordPress users may need to check their network connection, increase the timeout limit for cURL requests, or contact their web host to troubleshoot any server-related issues.

Specifically, cURL Error 28 means that there was a timeout while trying to connect to an external server. This error can occur for various reasons, such as a slow network connection, a misconfigured server, or a problem with the external server itself.

To understand the cURL error 28, you must first understand the role of cURL in your WordPress website.

There are different types of cURL errors and they occur due to reasons like:

  • Failure of SSL certificate verification because it’s outdated or invalid or due to incorrect server configuration.
  • Inability to connect with remote servers (of wordpress.org, email marketing services, payment gateway, and social media API servers) due to slow server response time, network connectivity issues, incorrect server configurations, or firewall restrictions.
  • The remote server returns an HTTP error code, which can be caused due to problems with the database, website code, or server configurations.
  • Outdated versions of WordPresspluginsthemes, and even PHP can cause cURL errors due to incompatibilities with newer versions of cURL.
  • DNS issues like incorrect DNS records, misconfigured DNS servers, or DNS cache issues can also cause the cURL error.

How to fix the cURL error 28

To fix this error, you can try the following steps:

  • Check your internet connection: Make sure that you have a stable internet connection and that your network is not blocking any ports.
  • Increase cURL timeout: You can try increasing the cURL timeout by adding the following code to your WordPress site’s functions.php file:

add_filter( 'http_request_timeout', function( $timeout ) {
    return 60;
} );

if the error keeps showing then do the following steps

  1. Disable the firewall ?
  2. Deactivate plugins ?
  3. Check for SSL misconfiguration ?️
  4. Update PHP & cURL versions ?
  5. Verify DNS settings ?‍?

Please note that you don’t have to complete all the steps simultaneously. You need to take one step at a time and then check your site to see if the error is gone. If the error persists, then proceed with the next step.

Also, take a backup of your website before trying any of these troubleshooting steps.

In the following solutions, you will be asked to carry out steps like deactivating plugins and updating PHP versions, among other things. These solutions could cause your website to break. The backup will be your safety net. In case things don’t go as planned, you can get your website up and running using the backup.

One more thing: clear your browser cache and check whether the error is still showing.

Browser caching is a technique used by web browsers to temporarily store website data, such as images and stylesheets, to reduce page loading time for subsequent visits to the same page.

Some WordPress errors appear temporarily and get removed within a few minutes. But you may still see the error because you are shown the cached page version. Therefore, clear your cache and make sure the error is still showing on your site before proceeding with the solutions.

1. Disable the firewall

Firewalls are meant to monitor your site and prevent malicious visitors from accessing it. Sometimes the firewall accidentally blocks legitimate requests causing a delay in the server response and this triggers the cURL error 28.

WordPress websites contain different types of firewalls. Some sites have a dedicated plugin installed, others have a firewall installed as an add-on to a security plugin or CDN (content delivery network).

You can disable the standalone dedicated firewall plugin from your WordPress dashboard (or via FTP if you can’t access your WordPress dashboard).

As for security services, a few of them have dashboards that can be accessed from the WordPress dashboard and others have external dashboards that can be accessed from the security plugin’s website. Wherever the dashboard is located, you need to find it and disable the firewall

CDNs also typically have external dashboards. Access it and disable your CDN’s firewall. for example, if your website is linked to Cloudflare and you activated any firewall rules then you will need to login to your dashboard and deactivate it

Now check whether your website is still showing the cURL error 28.

If disabling the firewall didn’t work then try the next solution.

2. Deactivate plugins

WordPress plugins and themes often make API requests to send and receive data from remote servers. When remote servers take too long to respond to that request, cURL operation times out triggering the cURL error 28.

So in this section, we will figure out whether a plugin or theme is causing the error on your website by deactivating them.

To deactivate your current theme, go to Appearance → Themes and activate any default WordPress themes like Twenty Twenty-Three or Twenty Twenty-Two, etc. Then check if the error is gone.

activating default wordpress themes

Next, deactivate all the plugins by going to Plugins → Installed PluginsSelect all the plugins, choose the Deactivate option, and hit the Apply button.

deactivate plugins from wp-admin - cURL error 28

Check your site to see whether the error is showing. If it’s not then the next step is to find the culprit plugin.

This can be done by activating the plugin individually and then checking your website each time a plugin is activated. The culprit plugin will trigger the error as soon as it’s activated. Remove that plugin from your site and replace it with an alternative.

If you can’t access your WordPress dashboard, you can disable themes and plugins using FTP.

3. Check for SSL misconfiguration

Improper SSL installation causes web servers to consider certain cURL requests as insecure. This can trigger errors like the cURL error 28 or cURL error 7 (http_request_failed).

To verify whether your SSL certificate is the real culprit, you need to check your SSL installation using the Qualys SSL Labs test. Just insert your URL and hit the Submit button. The tool will run a few tests and show you any misconfigurations it finds in your SSL installation.

SSL misconfigurations can be resolved by reinstalling the certificate.

For reinstallation, you will need to seek help from your SSL vendor which could be your hosting provider or an independent SSL provider.

4. Update PHP & cURL versions

To check whether you are using the latest versions of PHP and cURL do a quick Google search and note down the latest versions of both software.

Next, open your WordPress dashboard and go to Tools → Site Health → Info → Server.

checking php and curl version in wp-admin

Do your PHP and cURL versions match with the latest versions? If not then you need to update them. We have already covered how to update PHP in a different article. As for updating the cURL, you need to contact your hosting server and ask them to update the software for you.

Share this:

Facebook Comments

WP Twitter Auto Publish Powered By : XYZScripts.com