cURL error 28: Resolving timed out after 5001 milliseconds
When moving a WordPress installation from a shared cPanel environment to a DirectAdmin server on CentOS, DNS resolution behaviors can change unexpectedly. If you encounter the cURL error 28: Resolving timed out after 5001 milliseconds, it indicates that the client application attempting to make an HTTP request could not translate a domain name into an IP address within the allotted time. In your specific scenario involving Easy Digital Downloads (EDD) and WP Total Cache, this error blocks asset loading, effectively breaking downloads and cache updates.
The root cause is almost never a server-side network outage but rather a misconfiguration in how the server handles DNS queries or an exhausted system resource. The error message explicitly states "Resolving timed out," which distinguishes it from connection refused or SSL handshake failures. On CentOS 6.8 with cURL 7.54.0, the default timeout is set to 30 seconds (30,000 milliseconds), so a 5-second limit suggests an application-level configuration overriding the global settings.
Investigating Application-Level Timeouts
The WP Total Cache plugin and Easy Digital Downloads both rely on curl extensions for external API calls, cache purging, and asset fetching. When these plugins initialize a request, they often pass custom options to the underlying cURL library. If your configuration file or the plugin's internal settings define a timeout parameter of 5 seconds (5000 ms), cURL will abort the connection immediately once that threshold is reached without resolving the hostname.
To address this, you must inspect the specific plugin configurations. In WP Total Cache, navigate to Settings > W3 Total Cache and look for network or remote debugging settings. If there is a setting labeled "Remote fetch timeout" or similar, increasing it from the default 5 seconds to 10 or 20 seconds can resolve the immediate symptom. Similarly, check the EDD plugin settings under Easy Digital Downloads > Settings > Downloads. Some download scripts allow you to adjust the API timeout duration.
Verifying System-Wide cURL Configuration
If adjusting plugin settings does not yield results, the issue may lie in the system's default configuration or the PHP environment. You can verify the current timeout setting for your PHP installation by creating a temporary file named info.php in your root directory with the following content:
<?php phpinfo(); ?>
Access this URL via your browser and search for "curl". Look specifically for the default_timeout directive. If this value is explicitly set to 5 seconds, it will override the cPanel/DirectAdmin defaults. You can modify this by editing your php.ini file or creating a custom configuration file in the .user.ini directory (common in DirectAdmin setups) with the line:
default_timeout = 30
After saving the file, ensure that your web server restarts to apply the changes. Restarting Apache is typically sufficient on CentOS:
sudo service httpd restart
Checking DNS Resolver Health
A second critical factor is the system's ability to resolve domain names. If the server's /etc/resolv.conf file points to a nameserver that is slow or unresponsive, every DNS lookup will fail after the configured timeout. Verify your current DNS settings by running:
cat /etc/resolv.conf
If the listed nameservers are unreachable, update them to reliable public resolvers like 8.8.8.8 (Google) or 1.1.1.1 (Cloudflare). You can also check if the system is using a caching resolver like dnsmasq or bind. If dnsmasq is active, inspect its logs for failed queries:
tail -f /var/log/messages | grep dnsmasq
High latency in DNS resolution often manifests exactly as a "timed out" error because the resolver waits for a negative response or simply gives up after the default TTL expires.
Trade-offs and Best Practices
While increasing the timeout value resolves the immediate error, it is important to understand the trade-off. A longer timeout delays script execution if the target server is genuinely unresponsive. This can lead to timeouts on subsequent requests, potentially causing a cascade of failures during peak traffic. The optimal approach is to balance a reasonable timeout (10â30 seconds) with robust DNS infrastructure.
If you are deploying high-traffic sites, consider implementing a dedicated caching layer or using a content delivery network (CDN) that handles the initial asset resolution. This reduces reliance on your server's direct DNS lookups for static assets served by plugins like WP Total Cache. Always ensure that your PHP environment matches the cURL version expectations; CentOS 6.8 is quite old, and while cURL 7.54.0 is stable, newer PHP versions might require updated cURL libraries to handle modern TLS requirements efficiently.