I am seeing a strange issue where my
php.ini is not used if I do not explicitly pass it to
php-fpm when starting it.
This is the upstart script I am using:
start on (filesystem and net-device-up IFACE=lo) stop on runlevel  pre-start script mkdir -p /run/php end script expect fork respawn exec /usr/local/php/sbin/php-fpm --fpm-config /etc/php/php-fpm.conf
If PHP is started with the above, my
php.ini is never used, even though it is in
Configuration File (php.ini) Path.
This is the relevant part from
Configuration File (php.ini) Path /etc/php/ Loaded Configuration File (none) Scan this dir for additional .ini files (none) Additional .ini files parsed (none)
If I modify the last line of the upstart script to point
exec /usr/local/php/sbin/php-fpm --fpm-config /etc/php/php-fpm.conf -c /etc/php/php.ini
Then we see that the
php.ini is loaded:
Configuration File (php.ini) Path /etc/php/ Loaded Configuration File /etc/php/php.ini Scan this dir for additional .ini files (none) Additional .ini files parsed (none)
Why is this the case? Is this a quirk in php-fpm?
Minor update: This also seems to be a problem for php5-fpm installed using
I did a test install in a Ubuntu Server 12.04 virtual machine by running the following:
sudo apt-get install nginx php5-fpm
PHP-FPM and nginx were started after installation and everything seemed fine. I then uncommented php's settings in nginx's configuration and placed a test
phpinfo() file to inspect PHP's settings.
The relevant bits are:
Configuration File (php.ini) Path /etc/php5/fpm Loaded Configuration File (none) Scan this dir for additional .ini files /etc/php5/fpm/conf.d Additional .ini files parsed /etc/php5/fpm/conf.d/10-pdo.ini
I noted that no
php.ini was loaded either. However, if I go to
/etc/php5/fpm, I can see that a
php.ini exists. I also checked the start up scripts for PHP-FPM and the
-c parameter was not used to link the ini file to PHP. This can potentially be confusing for people who would expect php.ini to be loaded automatically by PHP-FPM.