tags:

views:

69

answers:

2

How do i make a Php script terminate after a fixed amount of time

+4  A: 

Using the max_execution_time setting in PHP.

Ie:

ini_set('max_execution_time', 30);

Would end the script after 30 seconds of execution (this is default in PHP)

You could also use:

set_time_limit(30);

See: http://php.net/manual/en/function.set-time-limit.php and http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time

Sbm007
+1  A: 

I would use the set_time_limit() function which specifies the amount of time a script is allowed to run after the point at which this function has been called.

More info here

Clayton