The phrase "maximum execution time" is ambiguous: it could mean (a) the elapsed time since the script started, or (b) the total cputime taken by the script (including or excluding the cputime taken by operating system calls).
The very interesting post by kuba here Real max_execution_time for PHP on linux , finds that this depends upon whether PHP is running on Unix or Windows. In essence he finds that on Unix it is (b) and on Windows or Cygwin it is (a).
But, my server is Linux 2.6.32-358.18.1.el6.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux, and I have a cron job that gets zapped after exactly 30 seconds elapsed time, despite its cpu time being less than 16 seconds:
[Tuesday, 10-Dec-2013 10:22:33 GMT] Begin, cputime=0 secs.
[Tuesday, 10-Dec-2013 10:22:58 GMT] starting zip_close, cputime=10.12946 secs.
[10-Dec-2013 10:23:03 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in xxx.php on line 149
This contradicts kuba's finding. Mine is PHP 5.3.26 and IU'm measuring cpu time with:
function cputime() {
$data = getrusage();
return $data['ru_utime.tv_sec'] + $data['ru_utime.tv_usec'] / 1000000;
Can anyone clarify further?
max_execution_time is set to 60 which is too low. A minimum execution time of 150 seconds is recommended to give the migration process the best chance of succeeding.
By default PHPs maximum execution time is set to 30 seconds of CPU time (time spent in streams and system calls are excluded from this).
The max_execution_time in PHP is the amount of time that your WordPress site will spend on a single operation before timing out. The error is the security precaution taken by WordPress. By default, the maximum execution time for PHP is set as 30 seconds.
This depends entirely on your script. getrusage
is not a reliable way to measure it. You're confused between 3 measurement methods, not 2:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With