php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52045 FPM tries to open php.ini from the current dir
Submitted: 2010-06-11 11:02 UTC Modified: 2010-11-11 18:25 UTC
From: FractalizeR at yandex dot ru Assigned: fat (profile)
Status: Closed Package: FPM related
PHP Version: 5.3.2 OS: CentOS 5.5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: FractalizeR at yandex dot ru
New email:
PHP Version: OS:

 

 [2010-06-11 11:02 UTC] FractalizeR at yandex dot ru
Description:
------------
If there is a file or directory named php.ini in the current directory and you start php-fpm from within this directory, phpinfo() output shows, that php-fpm is trying to use this file/directory as main configuration file for all it's children.

The case with such php.ini being a file seems to be undocumented and unwanted behavior because by default [prefix]/lib/php.ini should be used.

The case with php.ini being a directory leads to all php settings to be silently reverted to their defaults. No error message is shown about that php.ini is not a file or does not exist or whatever.

Test script:
---------------
cd ~
mkdir php.ini
php-fpm

After that open a page, containing phpinfo(); line and check php.ini settings section.


Patches

php_main_php_ini.c-fpm-cgi.patch.txt (last revision 2010-08-24 18:01 UTC by fat@php.net)
php_main_php_ini.c-fpm-cgi.patch (last revision 2010-08-20 16:45 UTC by fat@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-11 11:12 UTC] fat@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: fat
 [2010-06-11 14:10 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php_main_php_ini.c-fpm-cgi.patch
Revision:   1276258214
URL:        http://bugs.php.net/patch-display.php?bug=52045&patch=php_main_php_ini.c-fpm-cgi.patch&revision=1276258214
 [2010-06-11 14:11 UTC] fat@php.net
Can you please try the attached patch on trunk ?

It must be also working on branche/PHP_5_3.

++ jerome
 [2010-06-15 11:59 UTC] FractalizeR at yandex dot ru
How do I correctly apply it?
patch -d <php-source-dir> -i <patch-file-name> ?
 [2010-06-15 12:02 UTC] pajoye@php.net
cd php-src
patch < patchfile
 [2010-07-22 23:18 UTC] fat@php.net
Can you please test and report the result.

thx
++ Jerome
 [2010-07-23 13:36 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php_main_php_ini.c-fpm-cgi.patch
Revision:   1279885008
URL:        http://bugs.php.net/patch-display.php?bug=52045&patch=php_main_php_ini.c-fpm-cgi.patch&revision=1279885008
 [2010-08-20 18:45 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php_main_php_ini.c-fpm-cgi.patch
Revision:   1282322733
URL:        http://bugs.php.net/patch-display.php?bug=52045&patch=php_main_php_ini.c-fpm-cgi.patch&revision=1282322733
 [2010-08-24 19:54 UTC] fat@php.net
-Summary: Incorrect php.ini file detection +Summary: FPM tries to open php.ini from the current dir
 [2010-08-24 20:01 UTC] fat@php.net
The following patch has been added/updated:

Patch Name: php_main_php_ini.c-fpm-cgi.patch.txt
Revision:   1282672877
URL:        http://bugs.php.net/patch-display.php?bug=52045&patch=php_main_php_ini.c-fpm-cgi.patch.txt&revision=1282672877
 [2010-11-11 18:24 UTC] fat@php.net
Automatic comment from SVN on behalf of fat
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=305276
Log: - Fixed #52045 (FPM tries to open php.ini from the current dir)
- Add php_ini_ignore_cwd to _sapi_module_struct
 [2010-11-11 18:25 UTC] fat@php.net
-Status: Assigned +Status: Closed
 [2010-11-11 18:25 UTC] fat@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

This bug will be corrected in the next 5.4 release.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC