尽管同时设置了连接超时和超时,但 PHP curl 超时


Php curl timing out despite setting both connecttimeout and timeout

我已经设置了以下内容:

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);

在打电话之前curl_exec($ch)

但是,我时不时地收到一个错误:GOT AN ERROR<br/>Operation timed out after 10002 milliseconds with 0 bytes received<br/>-------<br/>

似乎 curl 不遵守超时设置。我也尝试设置_MS版本,但无济于事。请帮忙!

.htAccess 能够覆盖它们所在目录的服务器全局配置子集以及所有子目录。

在您网站的 .htaccess 中找到max_execution_time的属性。 我记得这个时间是几秒钟。

编辑:还要检查PHP.ini文件

<IfModule mod_php5.c>
php_value post_max_size 5M
php_value upload_max_filesize 5M
php_value memory_limit 300M
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.gc_maxlifetime 1200
</IfModule>

增加 php 的最大执行时间