UnderHost
Knowledgebase Docs

Timeout errors-diagnosis and resolution

Fix timeout and connection errors. DNS timeouts, connection refused, socket timeouts, PHP execution timeouts.

On this page

Timeout errors occur when a service takes too long to respond and the connecting program gives up waiting. Different services have different timeout values (DNS: 2-5 seconds, HTTP: 30 seconds, PHP: default 30 seconds).

DNS timeout

Error: "DNS timeout" or "DNS query timed out"

Causes: Slow DNS server, network issues, or DNS server overloaded

Fix:

  • Change DNS to 8.8.8.8 (Google) or 1.1.1.1 (Cloudflare)
  • Check your ISP's DNS is responding
  • Use UnderHost DNS Check tool to test DNS servers

Socket/connection timeout

Error: "Connection timed out" or "Connection refused"

Causes: Server unreachable, firewall blocking, or server down

Fix:

  • Verify server is online (ping domain)
  • Check firewall allows traffic on that port
  • Try from different network (mobile hotspot)
  • Wait if server recently started (may need boot time)

PHP execution timeout

Error: "Maximum execution time of 30 seconds exceeded"

Fix: Increase PHP timeout in wp-config.php:

define('WP_MEMORY_LIMIT', '256M');
set_time_limit(300);  // 5 minutes

Or in .htaccess:

php_value max_execution_time 300

Solutions by cause

For slow website performance

  • Enable caching (WP Super Cache)
  • Use CDN (CloudFlare)
  • Optimize database queries
  • Increase PHP memory and timeout

For external API timeouts

  • Check API service status
  • Increase socket timeout in code
  • Use asynchronous processing (don't wait for response)
  • Cache API responses locally

For upload/download timeouts

  • Split large file into chunks
  • Increase post_max_size and upload_max_filesize in php.ini
  • Use plugins designed for large files (WP Migrate DB Pro)
Different timeout types, different fixes

DNS timeout ≠ HTTP timeout ≠ PHP timeout. Identify which service is timing out before applying fixes.

Related: Connection refused errors | 504 Gateway Timeout | DNS resolution

Was this article helpful?

Still troubleshooting?

Use UnderHost tools for quick checks, or open a support ticket when the issue needs account or server access.

Related articles

Back to Troubleshooting