Page 1 of 1

PHP.ini Fine from command line - Ignored by Apache

Posted: Fri Nov 06, 2009 2:30 pm
by evilgonzo
Ive been going round in circles for ages, when viewing the output of a
test file that simply prints the phpinfo data when viewed via the
command line the php output shows all relevant config data as read via
/etc/php.ini however when viewed via the web this is not the case, even
though phpinfo says it is reading from the same file /etc/php.ini
There are no other php.ini files on the entire system.

Any ideas please?


Snippets of both outputs

First from the web/Apache
=/usr' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' Server API Apache 2.0 Handler Virtual Directory Support disabled Configuration File (php.ini) Path /etc/php.ini

Secondly from the command line
le-xmlwriter=shared' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--enable-dbase=shared' Server API => Command Line Interface Virtual Directory Support => disabled Configuration File (php.ini) Path => /etc/php.ini


As you can see from the outputs, whats enabled/disabled is not the same
as when viewed from the web various loaded modules are not enabled. Its basically like Apache is totally ignoring php.ini
I have tried adding

PHPIniDir "/etc"

into the apache conf (even tho phpinfo output indicates it knows where php.ini is already) but to no avail.

Re: PHP.ini Fine from command line - Ignored by Apache

Posted: Fri Nov 06, 2009 3:05 pm
by VladSun
Isn't it just the compile options line used to compile PHP Apache module and PHP-CLI?

Re: PHP.ini Fine from command line - Ignored by Apache

Posted: Fri Nov 06, 2009 3:19 pm
by evilgonzo
VladSun wrote:Isn't it just the compile options line used to compile PHP Apache module and PHP-CLI?
When run from the command line php.ini is read and applys all directives however when run via apache even tho phpinfo output indicates it is reading from /etc/php.ini (the same file the command line reads) no modifications are done to the configuration...

The phpinfo output from both the command line and apache start the same, but the command line extends these with those mentioned in php.ini

Re: PHP.ini Fine from command line - Ignored by Apache

Posted: Fri Nov 06, 2009 3:21 pm
by VladSun
Did you *restart* Apache service?

Re: PHP.ini Fine from command line - Ignored by Apache

Posted: Fri Nov 06, 2009 3:29 pm
by evilgonzo
VladSun wrote:Did you *restart* Apache service?

Yes, several times over the course of trying to solve the problem and try new variations. Its really frustrating.... :banghead:

Re: PHP.ini Fine from command line - Ignored by Apache

Posted: Fri Nov 06, 2009 3:33 pm
by VladSun
So, what exactly is not used from php.ini?
Did you llok at your Apache error logs?