Raptor Raptor - 6 months ago 126
PHP Question

PHP : Default cURL timeout value

What is the default PHP cURL timeout value ? Can I obtain the value from coding ?

Answer

The defaults are as follows:

  • CURLOPT_FTP_RESPONSE_TIMEOUT: Indefinite
  • CURLOPT_TIMEOUT: Indefinite
  • CURLOPT_TIMEOUT_MS: Indefinite
  • CURLOPT_CONNECTTIMEOUT: 300 seconds
  • CURLOPT_CONNECTTIMEOUT_MS: Indefinite
  • CURLOPT_ACCEPTTIMEOUT_MS: 60 seconds

Previous answer (for reference):

My understanding is that CURL obeys the default_socket_timeout unless overriden with CURLOPT_TIMEOUT/CURLOPT_CONNECTTIMEOUT.

$socket_timeout = ini_get('default_socket_timeout'); // timeout in seconds