Page 1 of 1

How to control execution time limitation

Posted: Sat Oct 04, 2008 10:03 am
by net1
Script return error and it stop run
PHP Fatal error: Maximum execution time of 30 seconds exceeded in /path/to/script.php on line 1288
Due to I don't want it to run longer than 30 secs as set max_execution_time = 30 in php.ini instead of stop and exit is there anyway to have some function to check without stop?

Informaton about the script:
- Runing on 5.2.5 with php-cli on Linux shell.
- Including with one script and it timeout when running function in this file.

Re: How to control execution time limitation

Posted: Sat Oct 04, 2008 1:12 pm
by jaoudestudios
Try this...

It might do the job with a small bit of tweaking.
http://www.forum.jaoudestudios.com/view ... ?f=13&t=11

It calculates the time for the page to compile so you should be able to check the time passed and then do something else if it has elapsed.

Re: How to control execution time limitation

Posted: Sat Oct 04, 2008 10:04 pm
by net1
Thanks jaoudestudios for idea but I think it is only check excute time but it can not handle when execute time longer than limit.

Is it possible to use Exception with Maximum execution time?