How to Fix ‘cURL Error 28 Connection Timed Out After X milliseconds’?

cURL is a software utility used for WordPress and web applications to send/receive data requests using URLs. 

In WordPress, we can use cURL to handle API requests. cURL is available as an extension in PHP; the cURL library plays a significant role in how WordPress works. However, if the cURL is not configured correctly, you may face an issue with your WordPress website functionality.

What Causes ‘cURL Error 28’ in WordPress?

You may receive the cURL error 28 when the WordPress website fails to respond to the server's data requests. WordPress uses REST API to send/ receive data requests. If you expand the detailed error, you may see the error message as shown below – 

Error: cURL error 28: Operation timed out after x milliseconds with x bytes received (http_request_failed)

How can we fix the WordPress error: ‘cURL Error 28: Connection Timed Out?

1. Temporarily Disable the WordPress Firewall
If you use a WordPress firewall or any other security plugin, you can temporarily deactivate it. You can also check the WordPress firewall logs to determine which API request is blocked. Once you find it, you can adjust your firewall settings to allow legitimate API requests.

2. Deactivate All the WordPress Plugins
WordPress plugins use API calls to send/ receive data. Therefore, if any data request takes a long time, it may cause the cURL 28 error. To verify which plugin is causing this issue, you can first disable all the WordPress plugins. 

You can refer to our article on ‘How to disable WordPress plugins?'

After that, you can verify the site health report. If it has disappeared, you can enable the plugins one by one until the error occurs again. Once you find the plugin causing the issue, you can disable it to fix the issue.

3. Fix SSL Insecure Content Issues
If you have redirected the WordPress website to HTTPS, but if the SSL setup is incorrect, you will face the cURL error, which has been depicted below – 

Error: cURL error 7: Failed to connect to localhost port 443: Connection refused (http_request_failed)

You can reinstall the SSL Certificate to fix this issue. 

Kindly refer to our article on 'How to install Auto SSL on WHM/cPanel?

4. Use the Latest PHP and cURL Versions.
You must ensure that you use the compatible and latest PHP and cURL.

You can refer to the article – ‘How to change the PHP version in cPanel?'


Was this answer helpful?

« Back

chat