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

 ID:                 42849
 Comment by:         zzz20120427 at pby dot com
 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:

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


Previous Comments:
------------------------------------------------------------------------
[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] paj...@php.net

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

------------------------------------------------------------------------
[2010-05-28 00:06:37] vera_cai at hotmail dot com

I have exactly the same problem that because of this bug, my PHP just can not 
work with mysql and keep complainning "Call to undefined function 
mysql_connect() ". 

I've tried 5.2.13, 5.3.2 and both had problem. Until searched forum with 
somebody mentioned to use "phpinfo" check where the php.ini located, I 
eventually find this bug. With one line added in httpd.conf file "PHPIniDir 
'c:\php'", the problem is gone. 

Can somebody help to fix this problem as this is not only annoying, I 
am not able to get PHP work with mysql because of this.

------------------------------------------------------------------------
[2010-03-18 23:30:08] rsberger1 at hotmail dot com

Since this bug was suspended due to "no feedback", I thought I'd supply
the requested feedback and hope that someone would fix this annoyance.

The two places in my phpinfo output regarding php.ini are:

Configuration File (php.ini) Path       C:\Windows
Loaded Configuration File               D:\Apps\MyFolder\php-5.3.2\php.ini

Apparently my php.ini is being loaded from my php-5.3.2 folder, but
phpinfo erroneously reports php.ini's path as C:\Windows.

------------------------------------------------------------------------
[2009-12-28 05:33:09] u2gohome at gmail dot com

Hi. For me this problem was only occurring when php was executed via apache. 
Executing php -i from the command line listed the mysql extension whereas a 
phpinfo() request via the browser did not. 

Try adding the following line to your apache httpd.conf file (to point to the 
directory containing php.ini) eg.

PHPIniDir 'C:\php'

Adding this line changed phpinfo()'s reported 'Loaded Configuration File' from 
(none) to C:\php\php.ini, and mysql started talking. However, phpinfo() still 
reports c:\windows as the php.ini directory.

Cheers, Matt

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


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

Reply via email to