Echte max_execution_time für PHP unter Linux

Nach der Dokumentation:

<code>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.
</code>

Dies wird durch Tests bestätigt:

Wird keine Zeitüberschreitung

<code><?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";
</code>

Wird eine Zeitüberschreitung

<code><?php
set_time_limit(5);
while (true) {
  // do nothing
}
echo "You got the page";
</code>

Unser Problem ist, dass wir möchten, dass PHP nach einer bestimmten Zeit eine Zeitüberschreitung ausführt, unabhängig davon, was es tut Zeit, wie 10 Sekunden). Wir wissen, dass wir mit Einstellungen wie der spielen könnenMySQL wait_timeout Für die SQL-Abfragen hängt das Seitenzeitlimit jedoch von der Anzahl der ausgeführten Abfragen ab.

Einige Leute haben versucht, mit zu kommenProblemumgehungen und es scheint nicht umsetzbar.

F: Gibt es eine einfache Möglichkeit, eine echte zu bekommen?PHP max_execution_time auf Linux, oder sind wir besser anderswo eine Auszeit, wie zApache Niveau?

Antworten auf die Frage(3)

Ihre Antwort auf die Frage