I have a cron PHP job that does not work after starting for 29 minutes. Error in log ( /var/log/php_errors.log):
[01-Mar-2012 00:32:57 UTC] PHP Fatal error: Maximum execution time of 60 seconds exceeded in /path/file.php on line 2079
The crontab entry that starts cron:
00 00 * * * /usr/bin/php /path/file.php
From my research, I do not think that this is related to configuration max_execution_time, because:
- I know that it works for 29:18 minutes (i.e. much more than the 60s as an error message).
- From PHP Docs - When starting PHP from the command line, the default value is 0.
Q: Why does the script end?
Notes:
The script is very heavy and executes many thousands of database queries, but I did top, and the CPU load was low.
The line from the error log is the call mysql_query:
$sql = "SELECT SUM(amount) FROM mytab WHERE mem = '$id' AND validto > '$now'";
$res = mysql_query($sql);
> php -v
PHP 5.3.10 (cli) (built: Feb 2 2012 17:34:38)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH
> cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
. , script 29 , PHP .
, , script, system(), , .., , script .
( ___(), max-execute-time docs). , script db API , .