Page 1 of 1

time limit

Posted: Mon Jul 23, 2007 5:49 pm
by pppswing
Hi,

I have a trouble of time limit. :?

I have a script that is calling a class and this class is making a giant loop.
it has to process thousands of rows in a database.

The problem is that when i put set_time_limit(5000) in the script, it doesn't seems to work.
Anyway it's doing only about 300 seconds max.

How can I force my script to run longer than 300 seconds ? :roll:

Do I have to put set time in the while loop ?

Maybe there is something to prevent loop to execute more than 300 s in order to prevent infinite loop.

Thanks
:)

Posted: Mon Jul 23, 2007 6:12 pm
by superdezign
Are you sure that it's not just running infinitely? Have you tried limiting the amount of tables that it processes to see if it works?

Posted: Mon Jul 23, 2007 6:44 pm
by s.dot
You might need to make usage of ini_set('max_execution_time', 28923724798238932)

Posted: Mon Jul 23, 2007 7:01 pm
by RobertGonzalez
You might also be using up all allowable memory as well. Are you checking your error logs to see what PHP is telling you? Or are there errors coming to the screen?

Posted: Mon Jul 23, 2007 8:22 pm
by Benjamin

Code: Select all

ini_set('max_execution_time', 0);
// or
set_time_limit(0);
If the code that is looping is including a file using include or require it's going to crash. If this is the case a hackjob would be to use require_once, although I would rewrite the code.