Page 1 of 1

PHP will not read php.ini

Posted: Wed Feb 28, 2007 11:04 am
by skeath
I have compiled PHP dozens of times, but never seen this.

Fedora core 6
Apache 2 (rpm)
PHP 5.2.1 (compiled from source)

I defined --with-config-file-path=/usr/local/lib

After install, moved a config file to that directory, named it php.ini, stopped and started Apache. Scripts run, but phpinfo()
reports php.ini not found, and displays only default settings.

I have changed ownership and permissions on php.ini, and recompiled with different configure parameters, but nothing works.

Has anyone seen this?

Posted: Wed Feb 28, 2007 11:06 am
by feyd
Is the PHPIniDir directive set in your httpd.conf?

PHPIniDir

Posted: Wed Feb 28, 2007 11:11 am
by skeath
No. Is that new to Apache 2?

Posted: Wed Feb 28, 2007 11:14 am
by feyd
When run as a module (maybe as a CGI too) under Apache 2, PHP has a directive called PHPIniDir. New for Apache 2 (over Apache 1.3,) but it's been in PHP for quite some time.

PHPIniDir

Posted: Wed Feb 28, 2007 11:42 am
by skeath
Thanks very much. I have been using Apache 1.3 before, but had to replicate a development environment that has Apache 2.

However, that change doesn't affect scripts run from the command line. It appears you can pass the path/php.ini to CLI with the -c switch, but
you cannot call the script directly using a shebang line. I always thought that was a cleaner way to call scripts from a cron.

Thanks.

Posted: Wed Feb 28, 2007 3:16 pm
by Chris Corbyn
Maybe it's not looking for /usr/local/lib/php.ini but actually looking for /usr/local/lib/php/php.ini ?