我正在使用cURL和PHP并在一段时间后得到以下错误(我想在300秒后):
致命错误:超出最大执行时间500秒。
我用Google搜索并发现了一些对我不起作用的解决方案,例如:
ini_set('MAX_EXECUTION_TIME', -1);
error_reporting(1); // to display only fatal error
set_time_limit(0);
我已经尝试了MAX_EXECUTION_TIME
和MAX_INPUT_TIME
并将它们设置为-1
,但没有任何东西可以帮助我。
更新
我也用过这个:
ignore_user_abort(true);
ini_set('MAX_EXECUTION_TIME', 0);
error_reporting(1);
set_time_limit(0);
在cURL
内
curl_setopt($s, CURLOPT_TIMEOUT, 0);
但它仍然给我以下错误:
致命错误:第321行的D:\ wamp \ www \ optimized.php超出了500秒的最大执行时间
将它设置为300,大约300秒= 5分钟
ini_set('MAX_EXECUTION_TIME', 300);
如果你把它设置为0,这意味着没有限制。
ini_set('MAX_EXECUTION_TIME', 0);
对于cURL,你可以使用这个
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
这里再次0意味着无限......
当你使用curl时,使用infinite
进行curl的超时0
curl_setopt($ch, CURLOPT_TIMEOUT, 0); // or provide number of seconds!
我改变 :
default_socket_timeout = 1200
在php.ini上
它对我有用。