Testing timeouts

According to php.ini, max_execution_time is set to 30 seconds. When running the following code snippet from browser, script runs much longer than 30 seconds, even longer than the apache timeout of 300 seconds.

example 1

Looks like the php command sleep does not add to the script execution time (at least with my current configuration).


example 2

leads to the expected PHP Fatal message about exceeded execution time. So using sleep() in a script to simulate timeout behaviour does NOT work.

The execution time limit can also be changed at runtime, see init_set(), max_execution_time and set_time_limit().

This entry was posted in PHP and tagged , , . Bookmark the permalink.

Leave a Reply