Link to home
Start Free TrialLog in
Avatar of medfacit
medfacitFlag for Australia

asked on

How do I change the Configuration File (php.ini) Path for PHP5?

Hi there,

I am manually installing PHP5 onto a x86 Windows 2003 box with IIS6. The version of PHP I am installing is 5.2.6. I have created a directory C:\PHP and placed PHP in this directory including the php.ini file. I have also downloaded and extracted the PECL binaries for this release.

I have added C:\PHP\ to the system's PATH variable and created a new variable called PHPRC to which it's value was set also to C:\PHP\. I have also created a registry entry at HKLM\SOFTWARE\PHP called IniFilePath and set that to C:\PHP.

Whenever I run phpinfo(), I am presented with two pieces of information. They read as follows:

Configuration File (php.ini) Path  -> C:\WINDOWS
Loaded Configuration File -> C:\PHP\php.ini

Although I have the mysql extension uncommented, I seem to unable to load this extension and use it. I'm thinking it's probably because I don't have the libmysql.dll file in my C:\WINDOWS directory, but I don't want this.

Can someone please advise how I can go about changing the Configuration File (php.ini) Path from C:\WINDOWS to C:\PHP?

Many thanks...
Avatar of thebradnetwork
thebradnetwork
Flag of United States of America image

I would reinstall and change the files to C:\PHP using the php installer.  When PHP is executed the path is going to look for the php.ini file in the same directory as the executable. If you do the installer it will automatically do the PATH and configure IIS. If you sepecific settings make sure you save your old php.ini file and just replace the new one with it.


Link to the installer
http://us3.php.net/get/php-5.2.6-win32-installer.msi/from/a/mirror
Avatar of medfacit

ASKER

Thanks thebradnetwork.

I tried using the installer and it the configuration path still says C:\WINDOWS. Before installing PHP via the installer I manually removed C:\PGP from the path variable (to allow the installer to do it) and removed the PHPRC variable. I then tried manually reinstalling and still getting the same result.

I have even gone to the trouble of setting up a fresh new server with only IIS installed and I am still getting the same result.
I have attached 3 print screens on things for you to check. With the installer it will give you the option to change the install directory. By default it is in the Program Files folder...you might want to check in there to make sure you havent over looked it. Also If you go to System properties then advanced tab > enviroment variables > scrolll down in the system variables to make sure your path is pointing to the PHP directory. Next go and make sure your IIS config is similar to mine. You will find that under the properites of the website and then home directory then configuration. If this is done correctly you shouldnt have to manually install anything. The install usually (notice i said usually :) does the work. Once you are done make sure to reboot.
installdirectory.jpg
path.jpg
config.jpg
Thanks thebradnetwork. Very good detailed instructions!!

Can you confirm that your Configuration File (php.ini) Path is set to C:\Program Files\PHP and that your Loaded Configuration File is C:\Program Files\PHP\php.ini? (Info available through phpinfo() )

I have already tried today the installer with no luck. I will try again though and ensure that I have the settings correct as per your screen dumps above.

Thanks.
Am I right in thinking that as I am using the pre-compiled Windows binaries, PHP has already been built with the C:\WINDOWS config path and that this is not changable?
Just finished trying again with the installer. Still doesn't appear to want to work. See attached picture.
phpinfo.jpg
I see what your saying now. I dont know why it displays it as C:\windows because if you do a search for the php.ini file you will see that it isn't located in there and that it is located in your C:\Program Files\PHP\php.ini. I just ran the phpinfo() on my server and it gave me the same thing. The file you need to edit is in the C:\program files\php\php.ini. Some one did report that as a bug pertaining to that...here is the link

http://bugs.php.net/bug.php?id=42849

This what I found on how to change the path

http://us3.php.net/configuration

Also you may want to change your session.save_path in the php.ini file to C:\php or whatever you would like it to be but as always make sure to backup your ini file first.
ASKER CERTIFIED SOLUTION
Avatar of medfacit
medfacit
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The only thing I can think of is that it is showing the system variable path...but the php.ini file is not in there.