php.ini curl timeout,curl默认超时(timeout)时间

It depends on which timeout setting you're talking about.

cURL offers various options specific to connection timeout settings. Some of these options have a set limit, while others allow transfers to take an indefinite amount of time. In order to understand which values have default settings and which do not, you need to look at libcurl's curl_easy_setopt() function: http://curl.haxx.se/libcurl/c/curl_easy_setopt.html

libcurl lists the following connection timeout specific settings:

CURLOPT_FTP_RESPONSE_TIMEOUT: No default (indefinite)

CURLOPT_TIMEOUT: No default (indefinite)

CURLOPT_TIMEOUT_MS: No default (indefinite)

CURLOPT_CONNECTTIMEOUT: Defaults to 300 seconds

CURLOPT_CONNECTTIMEOUT_MS: No default

CURLOPT_ACCEPTTIMEOUT_MS: Defaults to 60000 ms

The PHP source code does not override any of the above default settings: https://github.com/php/php-src/blob/master/ext/curl/interface.c. The only somewhat related parameter that the PHP bindings override is CURLOPT_DNS_CACHE_TIMEOUT, changing the default value from 60 seconds to 120 seconds: https://github.com/php/php-src/blob/a0e3ca1c986681d0136ce4550359ecee2826a80c/ext/curl/interface.c#L1926

One of the other answers stated that PHP will set CURLOPT_TIMEOUT to the value specified in the default_socket_timeout ini setting. I was not able to find anything in the PHP source code to back up this claim, and I was unable to trigger a cURL timeout by downloading a very large file with a default_socket_timeout setting of 1 second.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值