开发者

PHP Max Execution Reached: Script Ignoring PHP.ini FIle and Set Time Limit

I make 7 ge开发者_如何学Ct requests at the same time to one PHP script - two of the requests are successful and the other requests I get an output of Max Execution of 60 seconds exceeded!

The thing is I have put this at the top of my script:

set_time_limit(300000); 

I have also set this in my PHP.ini file and have restarted apache several times.

max_execution_time = 300000

Why does it keep giving me this error?!?

Thanks all

Update

I have just looked at firebug and it looks as if all requests are not fully fired i.e. it shows the request is still trying to be made. In this case, is it possible for PHP to throw that error if a request has been made to it but it has not started execution!?

It gives me that error on line 1 - so it didn't even run any part of this script - is this what it means?

Update 2

Just showing the full error:

[Mon Nov 23 13:05:37 2009] [error] [client 127.0.0.1] PHP Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\webs\process_txt.php on line 1, referer: http://localhost/webs/front-end/path.php

Why does it say line 1?


Check that ini_get reports the correct "max_execution_time". Also make sure that it reports for "safe_mode" 0 (though this is deprecated and set for removal in PHP 6) as the PHP docs state:

This function has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.

Also note in the documentation:

Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. Both default to 300 seconds. See your web server documentation for specific details.

Narrow down your problem. Ignore Ajax for the time being and perform a normal HTTP request on the page in question. Test the timeout to make sure the execution time is actually reached:

for ($i=1; $i<=300; $i++) {
    echo "<p>$i seconds</p>";
    flush();
    ob_flush();
    sleep(1);
}


Also, make sure you are using the right php.ini file. Using the wrong one happens very often. Call phpinfo() an check the php.ini path it outputs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜