Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 141370

Summary: PHP5 cli ignores values in php.ini
Product: Gentoo Linux Reporter: Marcel Meckel <>
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Severity: major CC: php-bugs
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Package list:
Runtime testing required: ---

Description Marcel Meckel 2006-07-22 03:43:07 UTC
# php -r 'phpinfo();' | egrep 'php\.ini|max_execution_time'
Configuration File (php.ini) Path => /etc/php/cli-php5/php.ini
max_execution_time => 0 => 0

# grep max_execution_time /etc/php/cli-php5/php.ini
max_execution_time = 0     ; Maximum execution time of each script, in seconds

# php -r 'echo ini_get("max_execution_time")."\n";'

# php-select php
/usr/bin/php is set to /usr/lib/php5/bin/php

# php -v
PHP 5.1.4-pl0-gentoo (cli) (built: Jul 20 2006 11:41:06)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

# time php /foo/bar/script_doing_mysql_thingies.php

Fatal error: Maximum execution time of 60 seconds exceeded in /foo/bar/script_doing_mysql_thingies.php on line 22

real    1m24.506s
user    0m2.500s
sys     0m57.532s

Even when changing the value max_execution_time in php.ini to lets say __30__ seconds, the script dies with Maximum execution time of __60__ seconds exceeded.

Where the does this 60 seconds come from?

# emerge -pv php

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] dev-lang/php-5.1.4  USE="apache2 bcmath bzip2 cli crypt gd hash imap memlimit mysql nls pcre posix readline reflection session spl ssl truetype unicode xml xmlreader xmlwriter zlib -adabas -apache -berkdb -birdstep -calendar -cdb -cgi -cjk -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filepro -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd-external -gdbm -gmp -hardenedphp -hyperwave-api -iconv -informix -inifile -interbase -iodbc -ipv6 -java-external -kerberos -ldap -libedit -mcve -mhash -ming -msql -mssql -mysqli -ncurses -oci8 -oci8-instant-client -odbc -pcntl -pdo -pdo-external -pic -postgres -qdbm -recode -sapdb -sasl -sharedext -sharedmem -simplexml -snmp -soap -sockets -solid -spell -sqlite -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer -vm-goto -vm-switch -wddx -xmlrpc -xpm -xsl -yaz -zip" 0 kB

# emerge --info
Portage 2.1-r1 (default-linux/x86/2005.1/vserver, gcc-3.4.6, glibc-2.3.6-r4, 2.6.14-vs2.0.1-gentoo i686)
System uname: 2.6.14-vs2.0.1-gentoo i686 Intel(R) Xeon(TM) CPU 3.00GHz
Gentoo Base System version 1.6.14
dev-lang/python:     2.3.5-r2, 2.4.2
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r2
sys-devel/gcc-config: 1.3.13-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -march=pentium4 -fomit-frame-pointer"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
USE="x86 alsa apache2 apm arts avi bitmap-fonts bzip2 cli crypt dri eds emboss encode foomaticdb gd gif gnome gstreamer gtk2 hardened isdnlog jpeg kde libg++ mad md5sum memlimit mikmod motif mp3 mpm-prefork mysql ncurses nls no-htdocs ogg oggvorbis opengl oss pam pcre pdflib perl png posix pppd qt quicktime readline reflection sdl session spl ssl tcpd tiff truetype truetype-fonts type1-fonts vorbis xml2 xmms xorg xv zlib elibc_glibc kernel_linux linguas_de userland_GNU"
Comment 1 Luca Longinotti (RETIRED) gentoo-dev 2006-07-22 03:53:52 UTC
Please update to dev-lang/php-5.1.4-r4 which fixes a bug in the handling of the max time values. Also, from, please note:

"max_execution_time	default: 0 (unlimited)	 Due to endless possibilities of using PHP in shell environments, the maximum execution time has been set to unlimited. Whereas applications written for the web are often executed very quickly, shell application tend to have a much longer execution time.

Note:  These directives cannot be initialized with another value from the configuration file php.ini or a custom one (if specified). This is a limitation because those default values are applied after all configuration files have been parsed. However, their value can be changed during runtime (which does not make sense for all of those directives, e.g. register_argc_argv)."

So, whatever you set in php.ini is anyway ignored and reset to 0 for max_execution_time. But the 60 seconds bug you were experiencing is as far as I can see caused by that bug that's fixed with upgrading your PHP installation, and the value of 60 seconds comes from the max_input_time directive if you were wondering.
Best regards, CHTEKK.
Comment 2 Marcel Meckel 2006-07-22 04:10:03 UTC
# time php -d max_execution_time=20 /foo/bar/script_doing_mysql_thingies.php

real    1m12.576s
user    0m2.768s
sys     0m52.675s

Why now the script didn't get terminated after 20 seconds?
Comment 3 Marcel Meckel 2006-07-22 04:12:10 UTC
Ok, will try new PHP version
Comment 4 Marcel Meckel 2006-07-22 05:32:46 UTC
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2006-07-22 07:45:03 UTC
Ok, closing.
Comment 6 Luca Longinotti (RETIRED) gentoo-dev 2006-08-10 09:17:47 UTC
Best regards, CHTEKK.