致命错误:超过500秒的最大执行时间 [英] Fatal error: Maximum execution time of 500 seconds exceeded
问题描述
我将cURL与PHP结合使用,并在一段时间后(我猜是在300秒后)收到以下错误:
I'm using cURL with PHP and getting the following error after sometime (I guess after 300 sec):
致命错误:超过了500秒的最大执行时间。
Fatal error: Maximum execution time of 500 seconds exceeded.
我在Google上搜索了一下,发现一些对我也不起作用的解决方案,例如:
I googled this and found some solutions that are also not working for me, such as:
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
,但没有任何帮助。
I've tried both MAX_EXECUTION_TIME
and MAX_INPUT_TIME
and set them to -1
but nothing is helping me.
更新
我也使用了它:
ignore_user_abort(true);
ini_set('MAX_EXECUTION_TIME', 0);
error_reporting(1);
set_time_limit(0);
并在 cURL
curl_setopt($s, CURLOPT_TIMEOUT, 0);
但它仍然给我以下错误:
but it is still giving me the following error:
致命错误:在第321行的D:wamp\www\optimized.php中,超过500秒的最大执行时间
Fatal error: Maximum execution time of 500 seconds exceeded in D:\wamp\www\optimized.php on line 321
推荐答案
设置为300也就是300秒= 5分钟
set it too 300 which is approx 300 secs = 5 minutes
ini_set('MAX_EXECUTION_TIME', 300);
如果将其设置为0,则表示没有限制。
if you set it to 0 , which mean no limits.
ini_set('MAX_EXECUTION_TIME', 0);
对于cURL,您可以使用此一个
for cURL you can use this one
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
这里再次0表示无限...
here again 0 means infinite...
这篇关于致命错误:超过500秒的最大执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!