문제

I have a script:

for ($i = 0; $i <= 7200; $i++) {
    echo $i.' - ';
    sleep(1);
}

But my server has:

ini_get('max_execution_time'); // == 30

Why script runs 7200 seconds (not execution time out), but max_execution_time is 30? set_time_limit () on the server is turned off

도움이 되었습니까?

해결책

The time you spend in sleep doesn't count towards the execution time.

다른 팁

sleep time is not taking in account as it is a system call.

See How does PHP max_execution_time work?

max_execution_time only affects script time not system calls like sleep().

sleep ($seconds);

sleep — Delay execution

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top