Bug #42849 [Com]: Configuration File (php.ini) Path incorrect

From: Date: Fri, 16 Nov 2018 00:23:42 +0000
Subject: Bug #42849 [Com]: Configuration File (php.ini) Path incorrect
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217984@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=42849&edit=1

 ID:                 42849
 Comment by:         q21 at bk dot ru
 Reported by:        inglis-php at yahoo dot com dot au
 Summary:            Configuration File (php.ini) Path incorrect
 Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   win xp pro
 PHP Version:        5.2.4
 Block user comment: N
 Private report:     N

 New Comment:

No, it's shoking how you misunderstand, spam2. I just had php-cgi.exe (PHP 7.2) which did not
find php.ini in its own folder; and setting PHPRC to that path didn't help. PHP looked for its
ini in C:\Windows and saw nothing else. Though C:\Windows can't have any relation to correct
php.ini location, because there can be many installations of various versions of PHP; how could they
rely on the same file in some strange outside dir? For ma the only solution that worked was setting
-c option. This behavior of PHP is intolerable.


Previous Comments:
------------------------------------------------------------------------
[2018-05-31 08:15:31] spam2 at rhsoft dot net

no, the solution is to rename one of them to php.ini
which one? 

well, depends on the machines use case - really! 
common sense anybody? 


this whole bugreport including all responses is shocking, if one fails to create a config file or
make a decision which one out of two files to rename please reconsider if you are qualified to write
code probably shared and used by others

------------------------------------------------------------------------
[2018-05-31 01:40:40] jabaruben at gmail dot com

Hi,

Seems to be that in the "C:/php" directory, sould be a file with the name php.ini, but in
the many cases, only php.ini-production and php.ini-development files are there.

The solution (for me) is change in httpd.conf the line: PHPIniDir C:/PHP/php.ini-production

And the magic go on!

Thanks!

------------------------------------------------------------------------
[2012-04-30 22:10:36] zzz20120427 at pby dot com

Well, I achieved success, but didn't pin down the bug.

I stripped *everything* out of my php.ini except the active lines, comparing them to the working
Windows 7 machine (from which I copied the Apache and PHP installers that fail on this Windows 7
machine).

The PHP msi must have added "C:\Program Files\PHP\;" to my PATH, and added
"PHPRC=C:\Program Files\PHP\" to my environment variables.  This would have been a
despised absolute last resort for me, but it led me to comment out PHPIniDir "C:/Program
Files/PHP/" in httpd.conf.  Apache and PHP still started with the still-unterminated (by a
quote) include_path string in php.ini.

As a crude solution, I tried moving include_path to the end of the file so that all the stuff after
it wouldn't be added to include path.  Apache wouldn't start.  Putting it back, I began
moving it downward to try find the point where it fails.  It first failed in the [PHP_EXIF] section,
so I commented out the extension=php_exif.dll.  It failed again in the [PHP_MSSQL] and
[PHP_PDO_MSSQL] sections; commented those extensions too.  There were no more crashes as I moved
further down the file so I put the include_path back in its original position; all was well.  Then,
I added the terminating quote to the include_path - it worked!  All of the modules appeared in
phpinfo.php.  It still (correctly) shows Loaded Configuration File as C:\Program Files\PHP\php.ini
but doggedly continues to show Configuration File (php.ini) Path as C:\Windows.  (Afterward, I
restored PHPIniDir to httpd.conf which caused no change.)

Funny thing: once I got it working, PHP finally began writing errors to its error log.  Thanks alot,
eh?  (The errors were a missing browscap.ini file that I had just added to the php.ini  It's
gone now.)

Perhaps those three modules load C:\Program Files\PHP\PEAR\go-pear.phar and that module objects to
the close quote on include_path, which causes everything else to go wrong?  Curiously, my other
Windows 7 machine doesn't object to PHP_MSSQL or PHP_PDO_MSSQL.

I hope this provides some clues to the developers.  It may not be quite the bug reported but it was
a sympton of another bug I was researching.

Apache installer:
httpd-2.2.16-win32-x86-openssl-0.9.8o.msi
PHP installer:
php-5.2.14-win32-installer.msi

------------------------------------------------------------------------
[2012-04-28 03:46:35] zzz20120427 at pby dot com

After installing PHP 5.2.14 via the msi installer, Apache 2.2.16 would no longer start - until I
tried the PHPIniDir 'C:\Program Files\PHP' trick (single quotes and backslashes).  But
PHPInfo showed Configuration File (php.ini) Path as C:\Windows and Loaded Configuration File as
(none).  (I have only one PHP.ini file and it's in C:\Program Files\PHP.)

Double-checking with PHP -i, I got several dialog boxes warning that the built-in dlls weren't
loaded.  PHPInfo showed an incorrect default directory for include_path so I uncommented
include_path and set it to C:\Program Files\PHP\PEAR.  No idea if this is correct but the dialog
boxes went away, but only if I didn't use a terminating quote!  (Otherwise Apache wouldn't
start.)

I also noticed that Loaded Configuration File was now displaying correctly - whether I used slashes
or backslashes, double-quotes or single-quotes.  Unfortunately, PHPInfo did not show the modules I
had enabled in PHP.ini.

I wonder why PHP will let Apache start with three quotes and not four.  Here are the settings I made
(I switched to forward slashes so the trailing backslash of a Windows path could not accidently
escape the quote.
httpd.conf:
PHPIniDir "C:/Program Files/PHP/"

PHP.ini:
include_path = ".;C:/Program Files/PHP/PEAR

BTW, moving the trailing quote from PHPIniDir to PHP.ini prevented Apache from starting.

------------------------------------------------------------------------
[2010-05-28 00:23:24] pajoye@php.net

Ask support in the PHP setup or PHP Windows mailing. Or to one of the numerous support channel out
there.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=42849


--
Edit this bug report at https://bugs.php.net/bug.php?id=42849&edit=1


Thread (27 messages)

« previous php.bugs (#217984) next »