The time you spend in sleep
doesn't count towards the execution time.
Why does my script runs longer than my server set max_execution_time?
-
30-07-2022 - |
Pregunta
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
Solución
Otros consejos
sleep
time is not taking in account as it is a system call.
sleep is not affected by max_execution_time
http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time
max_execution_time
only affects script time not system calls like sleep()
.
sleep ($seconds);
sleep — Delay execution
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow