Monday, May 24, 2010

PHP with IIS. Phpinfo displays PHP.ini to C:\Windows and not C:\PHP5 - why would this occur?

I have installed PHP on my system and copied and altered the default PHP.ini file. I have created the system path and setup the system variable and I have setup IIS to run scripts only and set PHP to run c:\php5\php5isapi.dll. When I run my test script which is in the wwwroot folder named "phptest.php" with the following code :


%26lt;? php phpinfo(); ?%26gt;





I get IIS to run the file however it displays that the PHP.ini file is located in C:\Windows and not C:\PHP5. Why is this?

PHP with IIS. Phpinfo displays PHP.ini to C:\Windows and not C:\PHP5 - why would this occur?
php.ini is searched in these locations (in order):





* SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)





* The PHPRC environment variable. Before PHP 5.2.0 this was checked after the registry key mentioned below.





* As of PHP 5.2.0, the following registry locations are searched in order: HKEY_LOCAL_MACHINE\ SOFTWARE\PHP\ x.y.z\IniFilePath, HKEY_LOCAL_MACHINE\ SOFTWARE\PHP\ x.y\IniFilePath and HKEY_LOCAL_MACHINE\ SOFTWARE\PHP\ x\IniFilePath, where x, y and z mean the PHP major, minor and release versions.





* HKEY_LOCAL_MACHINE\ SOFTWARE\PHP\ IniFilePath (Windows Registry location)





* Current working directory (except CLI)





* The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows)





* Windows directory (C:\windows or C:\winnt) (for Windows), or --with-config-file-path compile time option





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





I'm wondering if you set the PHPRC variable correctly. Try reading this article on the topic and see if it doesn't help you: http://www.iis-resources.com/modules/AMS...





It looks like right now, you're at this stage:


http://www.iis-resources.com/images/arti...





On page 3, it tells you how to get this result:


http://www.iis-resources.com/images/arti...





Hope this helps. Please let us know if this helps you as I'm sure other people have this problem and would benefit from a working solution.
Reply:I'd suggest you get a php book to help you..


No comments:

Post a Comment