Question

For PHP, what is the default time after which an HTTP request is deemed to have timed out?

I'm using the PECL HTTP extension to make HTTP requests. I can set a timeout limit when making a request, however I'd like to know what the default is if nothing is explicitly specified.

I've hunted through the PHP manual to no avail. I'd appreciate answers supported by evidence, such as a link to the relevant manual page, as opposed to speculative suggestions.

I'm keen to find out what the default timeout actually is not just what it probably is. I can guess it may probably be 30 seconds as this seems a reasonable value, however I can find nothing to confirm or deny this.

Was it helpful?

Solution

I'm quite sure what you're looking for is the default_socket_timeout php.ini option. It appears the default is 60 seconds.

OTHER TIPS

Just for future reference: http://svn.php.net/viewvc/pecl/http/trunk/http_request_api.c?view=markup

If I understood it correctly, the default timeout options values are:

  • timeout = CURLOPT_TIMEOUT_MS | CURLOPT_TIMEOUT = 0 (means "waits indefinitely")
  • connecttimeout = CURLOPT_CONNECTTIMEOUT_MS | CURLOPT_CONNECTTIMEOUT = 3
  • dns_cache_timeout = CURLOPT_DNS_CACHE_TIMEOUT = 60
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top