note 90936 added to install.windows
| From: | dpharshman at dslextreme dot com | Date: | Sun, 17 May 2009 00:52:24 +0000 |
| Subject: | note 90936 added to install.windows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154685@lists.php.net to get a copy of this message | ||
PHP 5.2.9.2 Install on XP Pro IIS 5.1 - phpinfo( ) results incorrect
Testing Date: 05.15.09
Background:
For several days now I, as a newbie, have been unsure if I had installed PHP correctly, or not. No
matter what I did phpinfo( ) reported "Configuratin File Path" as:
âC:\WINDOWSâ. I was left to wonder what was wrong.
To help resolve the phpinfo() âissueâ, I conducted a series of tests using two scripts:
The first is âtest-php-ini-loaded.phpâ; it is stored in c:\inetpub\wwwroot, and has the
following code:
<?php
$inipath = php_ini_loaded_file();
if ($inipath) {
echo 'Loaded php.ini: ' . $inipath;
} else {
echo 'A php.ini file is not loaded';
}
?>
The second script is simply calls phpinfo( ). It is named test.php, is stored in
âc:\inetpub\wwrootâ, and has the following code:
<?php phpinfo( ); ?>
My Dev Environment:
1. Windows XP Pro SP3
2. IIS 5.1 / MMC 3.0
3. PHP 5.2.9.2 â phpMyAdmin not yet installed
4. (plus MySQL 5.1, etc.)
5. Install location is on my local E: drive
The Tests:
Test 1:
a. PHPRC environment variable and IniFilePath Registry left in place and active
b. Verified no other copies of php.ini exist on the system other than in my E:\PHP folder
c. Renamed php.ini to hold-php.ini
d. Stopped and started IIS (ânet stop iisadminâ and ânet start w3svcâ)
e. Ran âtest-php-ini-loaded.phpâ to check whether my php.ini is loaded. It is not.
f. Ran "test.php". âLoaded Configuration Fileâ was empty, while
âConfiguration File (php.ini) Pathâ showed: C:\WINDOWS.
Test 2:
a. Moved php.ini from E:\PHP to C:\WINDOWS
b. Stopped and started IIS
c. Ran "test-php-ini-loaded.php" to check if my php.ini is loaded. It is not, which
surprised me.
d. Ran "test.php". My php.ini is apparently not loaded, or found, by phpinfo( ), even
though âConfiguration File (php.ini) Pathâ reports it as being in C:\WINDOWS.
e. Note: Per PHPâs âThe configuration fileâ note, PHP's search order includes:
âWindows directory (C:\windows or C:\winnt) (for Windows), ...â; but it apparently
doesnât or php.ini would have been found and displayed at âLoaded Configuration
Fileâ.
Test 3:
a. Left the solo copy of my php.ini in C:\WINDOWS
b. Disabled PHPRC environment variable by renaming it to âEx-PHPRC and saving the settings
(note: for this test I left the Registry entry for PHP IniFilePath intact)
c. Stopped and started IIS
d. Ran "test-php-ini-loaded.php" to check whether my php.ini is loaded. Predictably it is
not found.
e. Ran the "test.php". Again, my php.ini file is reported as not found in C:\WINDOWS
though âConfiguration File (php.ini) Pathâ reports it as being there.
Test 4:
a. To be thorough and eliminate all possible sources of âmis-directionâ I deleted the PHP
IniFilePath Registry entry (after backing up the Registry). The PHPRC environment variable was left
disabled.
b. Stopped and started IIS
c. Ran "test-php-ini-loaded.php" to check whether my php.ini is loaded. Predictably it is
not.
d. Ran "test.php". Again, no change. My php.ini file is not found âConfiguration
File (php.ini) Pathâ reports it as being there.
Conclusions:
The first conclusion I came to is that, in the default download version of phpinfo( ),
âConfiguration File (php.ini) Pathâ is hard-wired to report C:\WINDOWS whether php.ini is
there or not. Further, that C:\WINDOWS is not a default search location (at least not on XP).
However, given an otherwise âproperâ setup, phpinfo() reporting C:\WINDOWS as the value
for âConfiguration File (php.ini) Pathâ is merely misleading and is not actually harmful
or indicative of a failed installation.
Thanks go to Peter Guy of www.peterguy.com who suggested the testing, and to Daniel Brown of
www.php.net for some initial guidance.
P.S. This note is not meant to take anything away from PHP. It is a fine tool. The sole purpose
of the testing was to confirm that my installation of PHP was correct.
----
Server IP: 209.41.74.194
Probable Submitter: 208.127.186.232
----
Manual Page -- http://www.php.net/manual/en/install.windows.php
Edit -- https://master.php.net/note/edit/90936
Del: integrated -- https://master.php.net/note/delete/90936/integrated
Del: useless -- https://master.php.net/note/delete/90936/useless
Del: bad code -- https://master.php.net/note/delete/90936/bad+code
Del: spam -- https://master.php.net/note/delete/90936/spam
Del: non-english -- https://master.php.net/note/delete/90936/non-english
Del: in docs -- https://master.php.net/note/delete/90936/in+docs
Del: other reasons-- https://master.php.net/note/delete/90936
Reject -- https://master.php.net/note/reject/90936
Search -- https://master.php.net/manage/user-notes.php