0

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

2 Answers 2

4

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

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.