English 中文(简体)
PHP Max Execution Time: Incorrect Reporting?
原标题:

Is there any reason for a PHP script to return a fatal error of:

Fatal error: Maximum execution time of 60 seconds exceeded in 
H:xampplitehtdocsmlm	era.php on line 1

When my PHP ini is set to "300000" and further more I set set_time_limit(300000); in the script itself. Safemode is off. In addition, Apache s timeout has also been set to "300000".

Why would be PHP return this - I am happy to hear any case why this would happen!!

I am using this PHP script mainly to run queries via SQLCMD using the exec function. I get this error after the PHP script has been executing (supposedly) for well over 5 minutes.

Note: When answering this question please assume there is no doubt that I am using the right PHP.ini file etc and what I am claiming is what is actually happening.

Thanks all for any help

P.S. I have asked this question before but thought the other question was getting messy. I have made this more specific in the hope that I can finally close the book on this. Also this a test that I have done and I am not using AJAX any more.

Update

Line 1 of Script in question:

session_start(); 
ini_set("max_execution_time" , 300000); 
error_reporting(0);
ini_set( display_errors ,  0 );

(I have added a line break to make it easier to read)

最佳回答

I found this comment on php.net. Is your script waiting for input from somewhere else (like a file upload) that might be exceeding 60 seconds? 60 is the default time for max_input_time, which sets how long PHP will wait to receive file data.

问题回答

Is the phpinfo output actually showing the value you entered (300000) as the max_execution_time in the appropriate column? There is no differing local setting? There is no "60 seconds" anywhere in the whole phpinfo output, right?

I have to ask because the same thing has happened to myself more than once.

Then, could it be that what we are seeing is the command line output from a different script that you are executing from your main script? Or some other way that a PHP script from a different context is actually outputting this?

run a page with a simple php_info(); call as the only line. that will tell you what variable is really set for max execution time.

The execution time limit applies to php execution time, and doesn t include waiting for external programs or databases. That would explain why you re hitting the 60 second limit after over 5 minutes.

As for why you re still getting the 60 second limit, I don t know. It sounds like you re sure you are using the correct php.ini file, i d check any .htaccess files for php directives and check the setting with phpinfo() . Change a value in the config and verify it changed in phpinfo().

Also restart your webserver.

Have you tried setting max_execution_time to something a little lower like 300? Or do you really need three and a half days of execution time? (hint: if the answer is yes, PHP is probably not the tool for the job) Some quick googling didn t return any results, but I wouldn t be surprised if 300,000 exceeded some hard-coded limit in PHP or apache. I ve run it as high as 500 without problems, but never more than that.





相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...

热门标签