I have installed php 5.2 on 64 bit windows server 2003, and it is all working, except it will not read my php.ini file.

In phpinfo it just says C:\windows

I have tried:

Setting envt variable PHPRC to c:\php

Adding registry entry [HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\PHP"

And also registry entry [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PHP]
"IniFilePath"="C:\PHP"

And also just copying my php.ini file to C:\windows

None of these seem to work.

Has anyone set up PHP on 64 bit windows server 2003, and if so, how did you get it to read your php.ini file???

Thanks!

    First, you should not need to copy the file to c:\windows. It is much better to have everything that have to do with PHP in the same folder.

    Second, what web server do you use? If you use Apache you should set the path to C:/PHP (note the forward slash).

      As Piranha points out, we need to know which webserver you are using.

      If you are using Apache, and have installed PHP as an ISAPI module, there is a directive you can use within the httpd.conf file for Apache to specify where the php.ini file is.

      If you are using IIS, then setting the PHPRC variable is indeed the correct method. What steps did you take to set this variable? Did you completely restart the server after you made this change?

        4 days later

        Sorry, I forgot the important information - I am using IIS6

        I set the PHPRC variable by going into My Computer > Properties > Advanced > Environment Variables. Then clicking New under System Variables, and entering PHPRC as the name and C:\php as the value.

        I've restarted IIS, and restarted the whole server.

        If I type echo %PHPRC% at a command prompt, it correctly shows c:\php

        And my php.ini is definitely in c:\php, and I have added permissions on that directory for relvant users.

        I am wondering if it is related to 64 bit windows, as there were some extra steps to get PHP working with IIS at all in 64 bit windows?

        Thanks for your help!

          Try running this command on your webserver, replacing paths/drivenames as needed:

          cscript c:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

          I'm fairly sure you need to restart the computer after doing this.

          Also... how did you install PHP? As an ISAPI module (.dll file)? If so, did you add the ,dll as a new web service, set it to Allowed, and add a new file extension mapping (.php) to the ISAPI module (php5isapi.dll for PHP5)?

            Hi,

            Thanks for the reply - I have done everything you said already. PHP is installed as an ISAPI module, I set Enable32bitAppOnWin64 in the registry.

            PHP works fine, I can view a page with the output of phpinfo();

            But it does not find my php.ini file, so I cannot enable any extensions, such as the MS SQL one.

            Thanks for any more suggestions.

              anorakgirl wrote:

              But it does not find my php.ini file

              Did you add the PHPRC environment variable and add the PHP directory to your system's PATH environment variable?

                Yes! My initial post says that I set the PHPRC environment variable.

                And I have also added c:\php to my path.

                I have done exactly what the instructions say. I have installed php before, on my laptop running windows xp, setting PHPRC etc and it worked fine.

                I want to know if there is anything special I need to do on 64 bit Windows Server 2003?

                Thanks

                  Write a Reply...