2

Hi i'm trying to stop long running php scripts

so i've created this scrtipt for testing

<?php

ini_set('max_execution_time',1);
set_time_limit(1);

for($i=0;$i<2;$i++) {
        echo time();
        echo '    i:' . $i;
        echo '<br/>';
        sleep(2);
}
phpinfo();

the php info outputs

Directive           Local Value  Master Value
max_execution_time  1            30

but the script is not aborted after 1 sec. Why?

wutzebaer
  • 14,365
  • 19
  • 99
  • 170

2 Answers2

2

Sleep Time doesn't count towards max_execution_time or in other words: Sleep Time doesn't count as execution time.

See: Does sleep time count for execution time limit?

Community
  • 1
  • 1
Marcel Burkhard
  • 3,453
  • 1
  • 29
  • 35
0

This is a PHP Bug which should have been fixed in 5.3.1 . max_input_time overrides max_execution_time

Madra David
  • 151
  • 1
  • 8