Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Problem with maximum execution time



9:01 pm on Aug 27, 2007 (gmt 0)

10+ Year Member

I need to run a script which will take several minutes to complete, but the max execution time is 30 seconds and I cannot change that value.

Is there some way to detect the elapsed execution time of a script, in order to suspend it automatically and prevent the timeout?

Thanks in advance!


2:47 am on Aug 28, 2007 (gmt 0)

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member

set_time_limit(0); removes the limitation altogether
set_time_limit(X); sets the time limit to X

To detect run-time, use something like this:

while (($long_slow_loop)&&(time()<($start+25)))

The 25 allows 5 seconds spare, you may wish to cut it finer depending on how fast your loop runs.


6:01 pm on Aug 28, 2007 (gmt 0)

10+ Year Member

Thanks, I'll try that.

Featured Threads

Hot Threads This Week

Hot Threads This Month