[Bug 282674] [NEW] max_execution_time and max_input_time settings in php.ini are ignored by php cli

Chris Fryer c.j.fryer at lse.ac.uk
Mon Oct 13 14:00:33 BST 2008


Public bug reported:

Binary package hint: php5

Using PHP 5.2.3-1ubuntu6.4 (cli) (built: Jul 23 2008 06:20:35) on Ubuntu
7.10

Steps to reproduce:

Edit /etc/php5/cli/php.ini
Change "max_execution_time" to a non-zero value, e.g. 10
Change "max_input_time" to a non-zero value, e.g. 10

php -i | grep max_

max_execution_time => 0 => 0
max_input_time => -1 => -1

The file is definitely being read:

php -i | head -n 20

phpinfo()
PHP Version => 5.2.3-1ubuntu6.4

System => Linux testubuntu.lse.ac.uk 2.6.22-15-server #1 SMP Wed Aug 20 19:08:24 UTC 2008 i686
Build Date => Jul 23 2008 06:18:41
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
additional .ini files parsed => /etc/php5/cli/conf.d/apc.ini,
/etc/php5/cli/conf.d/curl.ini,
/etc/php5/cli/conf.d/gd.ini,
/etc/php5/cli/conf.d/ldap.ini,
/etc/php5/cli/conf.d/mysql.ini,
/etc/php5/cli/conf.d/mysqli.ini,
/etc/php5/cli/conf.d/pdo.ini,
/etc/php5/cli/conf.d/pdo_mysql.ini,
/etc/php5/cli/conf.d/xmlrpc.ini

A quick check to see if max_execution_time is set elsewhere:

grep -R max_execution /etc/php

/etc/php5/apache2/php.ini:max_execution_time = 30     ; Maximum execution time of each script, in seconds
/etc/php5/cli/php.ini:max_execution_time = 10     ; Maximum execution time of each script, in seconds

So it is not being specified in any configuration files read by the
command-line interpreter

Test case:

nano test.php

<?php

while (true) {
	echo "AAAAAA!\n";
}

?>

php test.php > /dev/null&

top -d 1

Watch php continue to execute past 10 seconds of CPU time.  You will
have to stop php manually, e.g. "fg", then ^C, or "killall php"

Return to the test case, and add

ini_set('max_execution_time', 10);

to the top of the file, then repeat the test.  Watching top will show
php exits after 10 seconds.  If you have configured error logging, you
will see "PHP Fatal error:  Maximum execution time of 10 seconds
exceeded in /home/testuser/test.php" in whatever you have specified for
error_log

** Affects: php5 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
max_execution_time and max_input_time settings in php.ini are ignored by php cli
https://bugs.launchpad.net/bugs/282674
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to php5 in ubuntu.



More information about the Ubuntu-server-bugs mailing list