Page 1 of 1
php.ini settings not taking effect
Posted: Tue Nov 10, 2009 3:29 am
by josh
I set max_execution_time = 200 in php.ini
Code: Select all
# cat /etc/php.ini | grep max_execution
max_execution_time = 200 ; Maximum execution time of each script, in seconds
phpinfo shows that is the file it does load
Code: Select all
# php -i | grep php.ini
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
yet it shows a value of 0 for that value
Code: Select all
# php -i | grep max_execution
max_execution_time => 0 => 0
What's going on?
Re: max_execution_time
Posted: Tue Nov 10, 2009 3:49 am
by urooj786
use this function---
set_time_limit(200);
Re: max_execution_time
Posted: Tue Nov 10, 2009 6:14 am
by josh
I could.. but that doesn't explain it. Anyways I am reinstalling linux on that machine so we will see if it is something in the code.
Re: max_execution_time
Posted: Tue Nov 10, 2009 6:33 am
by Eran
There might be additional configuration files overriding this value. Check in your phpinfo output under "Scan this dir for additional .ini files " for paths that it might include.
Re: max_execution_time
Posted: Tue Nov 10, 2009 7:11 am
by josh
There was one included .ini and it only had like 2 lines, neither of which overrided. What was wierd is the value looks like a multi-dimensional array. Anyways I just finished restoring my svn repository, will test out now on a different distro
Re: max_execution_time
Posted: Tue Nov 10, 2009 8:16 am
by Eran
Check also for overriding htaccess files which can use the php_flag operator to override it
Re: max_execution_time
Posted: Tue Nov 10, 2009 9:06 am
by josh
Hmm well I just installed a new distro on a fresh drive and its working, there wasnt any overriden php.ini settings in the code and no .htaccess, oh well. go figure
Re: max_execution_time
Posted: Wed Nov 11, 2009 4:38 am
by josh
Well the whole root of this problem was a PHP bug I was trying to work around. It seems like PHP is getting buggier and buggier. This is on a new system, compiled PHP myself from 5.3
Code: Select all
# php -i | grep memory_limit
memory_limit => 128M => 128M
[root@localhost k12]# php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
[root@localhost k12]# cat /usr/local/lib/php.ini | grep memory_limit
memory_limit = 1024MB;
Code: Select all
phpinfo()
PHP Version => 5.3.0
System => Linux localhost.localdomain 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64
Build Date => Aug 1 2005 20:52:21
Configure Command => './configure' '--with-mysqli=mysqlnd' '--with-mysql=mysqlnd'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20090626
PHP Extension => 20090626
Zend Extension => 220090626
Zend Extension Build => API220090626,NTS
PHP Extension Build => API20090626,NTS
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
Registered PHP Streams => php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports => tcp, udp, unix, udg
Registered Stream Filters => convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
Should I report it?
There is no .htaccess file because this is the command line
There is no .php scripts calling any functions, as you see I am just invoking php -i so it should only read settings from php.ini
I also can't get xdebug to load. I tried installing with pecl, I tried phpiz'ing and compiling myself, settings simply do not take affect.
The other problem I was having is when scripts finished executing memory usage and cpu went up to 100% and PHP never finished the script. It was doing this line on an exit() call. If I changed exit() to return() it happened on the ?> (closing tag) line. Since I reformatted that seems to have gone away, thankfully.
Re: php.ini settings not taking effect
Posted: Wed Nov 11, 2009 4:45 am
by Eran
just to be on the safe side, you restarted apache after changing the settings, right?
Re: php.ini settings not taking effect
Posted: Wed Nov 11, 2009 4:46 am
by josh
It's CLI, there is no apache running. I'm setting up a cruise control server. Its finally working after 4 days of debugging various stuff. But I have to use ini_set() calls and I can't get xdebug to load for the code coverage.
I'm recompiling right now but when its done I'm going to try to run PHP's unit tests
Re: php.ini settings not taking effect
Posted: Thu Nov 12, 2009 2:36 am
by josh
I had to copy an en entire sample php.ini and then splice my settings into the correct places.
I guess if you just have a php.ini file that says memory_limit = 150MB for instance it will not be read
Although commenting out the "
Code: Select all
" at the top had no effect, and the rest of the "section headers" are just comments. What gives? Is this documented behavior?