Hi guys, I am completely dumb and I cannot let php read the php.ini file that's in c:\php under my win2k server.

I have only installed the MSI downloaded from the website. Can someone of you explain me step-by-step what should I do in order to let php read my c:\php\php.ini file?

here's my phpinfo configuration file.

Edit: I have tried to read the other topics but I didn't get a clue of what is my problem.

    According to your configuration file, PHP is looking for php.ini in the C:\WINNT directory, not in c:\php.

      If PHP couldn't find a php.ini file at startup then phpinfo prints just one of the directories where it expects php.ini to be (without the filename itself).

      If PHP could find a php.ini file at startup then phpinfo always print the full path to php.ini including the file.

      But you can specify the path by setting the environment variable PHPRC to e.g. C:\PHP

      So set PHPRC to C:\php then restart the web server and check in the phpinfo output if the directory changed.

      Additionally, on Windows you can set a registry key (I think you don't need to do this if you set PHPRC, just make sure that the key has the correct value in case it already exists):

      HKEY_LOCAL_MACHINE\SOFTWARE\PHP\5\IniFilePath -> c:\php

        When you say "restart the web server" you mean that I have to reboot the whole machine?

        I'm asking that because I have set the enviroment variable AND the registry key without rebooting the Windows 2000 (IIS) server - just stopping and re-starting the IIS web service, and the phpinfo page is still the same as before.

          I'm asking that because I have set the enviroment variable AND the registry key without rebooting the Windows 2000 (IIS) server - just stopping and re-starting the IIS web service, and the phpinfo page is still the same as before.

          That is what is meant by "restart the web server".

            it doesn't work. The PHPinfo page is still the same. Tonite I'll reboot the server and let's see tomorrow what happens (now it's 4pm)

              By the way ... which php version do you have on the server ? Also make sure that c:\php is part of the PATH environment variable

                I have downloaded & installed the file named "php-5.2.5-win32-installer.msi" so I suppose this is the 5.2.5 version

                  I edited my last post just before your reply came in. Check the PATH environment variable.

                  The php manual has a section where they write that one needs to restart the complete server after modifying the environment variables (or registry). I'm not sure if that's true but in worst case we'll have to wait until tomorrow.

                    I still have the same response as shown in my first post.

                    these are my enviroment variables

                    ALLUSERSPROFILE=C:\Documents and Settings\All Users
                    APPDATA=C:\Documents and Settings\Administrator\Dati applicazioni
                    CommonProgramFiles=C:\Programmi\File comuni
                    COMPUTERNAME=SERVER
                    ComSpec=C:\WINNT\system32\cmd.exe
                    HOMEDRIVE=C:
                    HOMEPATH=\Documents and Settings\Administrator
                    LOGONSERVER=\\SERVER
                    MIBDIRS=\mibs
                    NUMBER_OF_PROCESSORS=2
                    OS=Windows_NT
                    Os2LibPath=C:\WINNT\system32\os2\dll;
                    Path=c:\programmi\imagemagick-6.3.8-q16;C:\PHP\ext;C:\PHP\;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\PROGRA~1\NcFTP
                    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
                    PHPRC=c:\php
                    PROCESSOR_ARCHITECTURE=x86
                    PROCESSOR_IDENTIFIER=x86 Family 15 Model 3 Stepping 3, GenuineIntel
                    PROCESSOR_LEVEL=15
                    PROCESSOR_REVISION=0303
                    ProgramFiles=C:\Programmi
                    PROMPT=$P$G
                    SystemDrive=C:
                    SystemRoot=C:\WINNT
                    TEMP=C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp
                    TMP=C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp
                    USERDNSDOMAIN=alberici.local
                    USERDOMAIN=ALBERICI
                    USERNAME=Administrator
                    USERPROFILE=C:\Documents and Settings\Administrator
                    windir=C:\WINNT
                    

                    and attached there is my PHP.ini file along with the PHPINFO page that is shown by <? phpinfo() ?>

                    I am getting crazy! Please help me!

                      I just noticed that in the phpinfo output you have extension_dir=C:\php5
                      which differs from c:\php

                      Just to make sure ... is PHP in c:\php or in c:\php5 ?

                        c:\php and in the php.ini it's right:

                        default_socket_timeout = 60
                        upload_tmp_dir="C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\php\upload"
                        session.save_path="C:\DOCUME~1\ADMINI~1\IMPOST~1\Temp\php\session"
                        extension_dir="C:\PHP\ext"

                        It seems that php.exe that's in C:\PHP doesn't find the php.ini file that is in the same directory... weird...

                          Search the php.ini file for more instances of extension_dir - are there any?

                          Also, try changing other directives (e.g. display_errors) and see if those changes are reflected in a phpinfo() output. Note that you'll have to restart IIS after you make changes to php.ini.

                            I have tried, but I think it's useless to change php.ini configuration file unless php.exe doesn't try to read it.

                            I think it's something about system variables / windows registry keys

                              If you've set the PHPRC environment variable (and restarted the entire server - not just IIS), then IIS should look in that directory for php.ini.

                              All I can say is.. double check that a) the IIS worker process has permission to read the php.ini file, and b) make sure that you're viewing file extensions in Windows (e.g. the file could be named php.ini.txt if you're not).

                                Write a Reply...