I was expecting some error like 500 or timeout page with the following code:
<?php
ini_set('max_execution_time',5);
set_time_limit(5);
echo 'start';
sleep(10);
echo '<br/>hi';
However, I get something like this:
start hi
Did I do something incorrect?
All I want is see the script stoped when timesout in the 5thd second, so the second echo should not be executed(I know this is quite a weird requirement)
Could anyone shred a light, thanks.
PS: seems the sleep() part is quite a distraction, how about I change the code like this:
<?php
ini_set('max_execution_time',5);
set_time_limit(5);
echo 'start';
for($i=1;$i<100000000;$i++){
if($i%100==2) echo $i;
else echo '--';
}
echo '<br/>hi';
sleepcalls in your "work" code? How do you know that it's taking longer than the max_execution_time?