Exact meaning of PHP max_execution_time Exact meaning of PHP max_execution_time unix unix

Exact meaning of PHP max_execution_time


This depends entirely on your script. getrusage is not a reliable way to measure it. You're confused between 3 measurement methods, not 2:

  1. The absolute time since the startup of the script
  2. The runtime of the script, so 1. minus system calls
  3. Actual time the CPU is busy, so 2. minus other idle times because of wait states and the like

getrusage measures 3, and is not what is documented. As such you're seeing the conflicting results - apparently your script has 14 seconds of general wait states and other inactive periods, without actually yielding completely like you would with system or streaming operations.

As the PHP docs state Windows uses method 1, and *nix systems use method 2. Nobody uses 3 because it doesn't really make sense as a timeout - it would mean timeouts become extremely aggressively tighter when system load is high and wait states rise.


AFAIK it is dependant on the OS. Depending on the OS, the time taken to execute a shell exec or query for example will (eg windows) or wont (eg linux) be included in the take for max_execution_time.


have a look at the documentation:

http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time

how the programmers decided to implement the requirement it's obviously another story:)that's one of that cases in which the underlying OS matters a lot. The available APIs about cpu time on the particular OS will clearly shed some light on the problem.

this high-level requirement (the script running time) it's ambiguous and can be interpreted by the OS in many different ways. The proof is the different timings you get.

so there are many "right answers", exactly one per OS...