According to the documentation:reale max_execution_time per PHP su Linux
max_execution_time only affect the execution time of the script itself.
Any time spent on activity that happens outside the execution of the script
such as system calls using system(), stream operations, database queries, etc.
is not included when determining the maximum time that the script has been running.
This is not true on Windows where the measured time is real.
Ciò è confermato da test:
non saranno sospese
<?php
set_time_limit(5);
$sql = mysqli_connect('localhost','root','root','mysql');
$query = "SELECT SLEEP(10) FROM mysql.user;";
$sql->query($query) or die($query.'<br />'.$sql->error);
echo "You got the page";
scadrà
<?php
set_time_limit(5);
while (true) {
// do nothing
}
echo "You got the page";
Il nostro problema è che ci piacerebbe molto che PHP scadesse, indipendentemente da ciò che sta facendo, dopo un certo periodo di tempo (dato che non vogliamo mantenere le risorse impegnate se sappiamo di aver fallito nel consegnare una pagina in un tempo accettabile, come 10 secondi). Sappiamo che possiamo giocare con impostazioni come lo MySQL wait_timeout per le query SQL, ma il timeout della pagina dipenderà dal numero di query che vengono eseguite.
Alcune persone hanno provato a trovare workarounds e non sembra implementabile.
D: C'è un modo semplice per ottenere un vero PHP max_execution_time
su linux, o siamo una migliore tempistica altrove, come ad esempio Apache
livello?
questo non influirà sull'elaborazione PHP – kuba
infatti, ho testato con 'TimeOut' di Apache impostato su' 2' (secondi) e non ha alcun effetto. C'è qualcos'altro oltre a 'mod_reqtimeout' puoi consigliare John? – Max