views:

315

answers:

6

Hello all,

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:\xampplite\htdocs\mlm\tera.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)

+1  A: 

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.

Zak
I have been asked this before and I have already confirmed this - hence why I have stated in my question to take everything I have said in my question as absolute fact, beyond all reasonable doubt. I have made it bold now.
Abs
Just to add - I have been struggling with this for a 2 days so I am pretty sure of my facts. ;)
Abs
well then post the results of the php_info dump so we can see the value PHP is assigning to it...
Zak
no need to be snarky with people who are trying to help you.
Rob
I don't know what you mean by "snarky" but my intention is to let you know that I am positive that my settings are as I have set them.
Abs
A: 

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.

keithjgrant
You can set an indefinite timeout by specifying `0`.
Paul Lammertsma
I've run many a script for months at a time, using `set_time_limit(0)`. PHP's certainly not ideal for those sorts of jobs, but sometimes it's convenient (since you can reuse your application's objects, libraries, etc.)
Frank Farmer
+1  A: 

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.

Rob
The thing is I have set it "300000" - if it returned a fatal error of "300000" seconds has been exceeded then I would be really happy as I can see PHP is working in the way it is supposed to.
Abs
A: 

Can you post the first lines of

H:\xampplite\htdocs\mlm\tera.php

?

Pekka
I have done that now.
Abs
+2  A: 

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?

Pekka
+4  A: 

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.

keithjgrant
Good observation - but would it return a max_execution warning or a max_input warning?
Abs
Does passing a variable via AJAX seen as an input?
Abs
Read the comment and another forum and it would return max_execution error! Strange! Let me set this and test it.
Abs
Yep, Solved my issue. I needed to extend the max_input time too! Thank you very much keithjgrant. :)
Abs