php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63782 php.ini not loaded by php-fpm unless -c switch is used
Submitted: 2012-12-16 08:40 UTC Modified: 2012-12-23 18:48 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: infected817 at gmail dot com Assigned:
Status: Not a bug Package: *Configuration Issues
PHP Version: 5.4.9 OS: Ubuntu Desktop 12.10
Private report: No CVE-ID: None
 [2012-12-16 08:40 UTC] infected817 at gmail dot com
Description:
------------
I am seeing an issue where PHP 5.4.9 I compile myself or installed via apt-get will not load the php.ini file even if it exists in the "Configuration File Path" unless I pass in a -c "/path/to/php.in" to start up PHP-FPM.

1. To reproduce, compile PHP 5.4.9 with these configuration options: --prefix=/usr/local/php-5.4.9 --with-config-file-path=/etc/php5/

2. Run make & make install.

3. Copy the stock php.ini-development to /etc/php5/php.ini

4. Create a phpinfo() file on the webserver.

5. Start PHP-FPM and browse to that phpinfo() file.

6. See the following result in the output:

Configuration File (php.ini) Path 	        /etc/php5/fpm
Loaded Configuration File 	                (none)

7. However, if we start PHP-FPM with the -c switch: 
./php-fpm --fpm-config /etc/php5/php-fpm.conf -c /etc/php5/php.ini

We see that php.ini is loaded:
Configuration File (php.ini) Path 	        /etc/php5/fpm
Loaded Configuration File 	                php.ini


The configuration is not loaded at all unless you explicitly pass it using the -c switch to php.ini. That is even though php.ini resides in the "Configuration File Path"

 

Expected result:
----------------
php.ini should be loaded since it is in the "Configuration File Path"

Actual result:
--------------
php.ini is not loaded at all, even though it exists in the "Configuration File Path"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-16 10:58 UTC] reeze@php.net
-Status: Open +Status: Feedback
 [2012-12-16 10:58 UTC] reeze@php.net
It's compiled with: /etc/php5/fpm

Configuration File (php.ini) Path 	        */etc/php5/[fpm]*
Loaded Configuration File 	                (none)

but you try to load php.ini from: /etc/php5   <-- no fpm
it's different.
 [2012-12-16 22:28 UTC] infected817 at gmail dot com
Hi there,

I actually made a mistake when copying the contents of the phpinfo() output as I had 2 virtual machines running at the time. My apologies for that.

I just checked again and these are the results:

Ubuntu Desktop 12.10
Configuration File (php.ini) Path 	/etc/php5/
Loaded Configuration File 	        (none) 

However, there is a valid php.ini in /etc/php5 that is not being loaded.

Is there anything else/more information I can check/provide?
 [2012-12-17 02:30 UTC] infected817 at gmail dot com
Clarified php.ini location.
 [2012-12-17 02:30 UTC] infected817 at gmail dot com
-Status: Feedback +Status: Open
 [2012-12-17 02:52 UTC] laruence@php.net
make sure that  you have did "make clean" after you re-configure
 [2012-12-17 03:35 UTC] infected817 at gmail dot com
Mystery solved.

I recompiled PHP with this configuration flag: --with-config-file-path=/etc/php5

Notice that before, I used --with-config-file-path=/etc/php5/

The trailing slash seems to be causing problems.

I think it would be helpful to do the following:
- Fix PHP to accept configuration folders with or without the trailing slash.

OR

- Add a note for --with-config-file-path in ./configure --help that says the trailing slash should be omitted.
 [2012-12-23 18:48 UTC] felipe@php.net
-Status: Open +Status: Not a bug
 [2012-12-23 18:48 UTC] felipe@php.net
Already exists a hint which does not uses trailing slash.

"  --with-config-file-path=PATH
                          Set the path in which to look for php.ini [PREFIX/lib]"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 12:01:29 2024 UTC