Take a quick look at the following snippet:
<?
set_time_limit(5);
sleep(30);
echo 'done';
?>
When I execute this on my boxes, the script takes the full 30 seconds, and displays 'done'.
Why?
Shouldnt it terminate in 5 seconds and not give the script the time to display 'done'?
This is NOT in CLI mode. Nginx + PHP_FPM.
Any ideas?
I have opted to put the 'answer' in here as there is quite a few GOOD and VALID answers below. But... It appears to be a specific issue with sleep.
<?
set_time_limit(5);
while(true==true){
}
sleep(30);
echo 'done';
?>
Works as expected.