Solved

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

Posted on 2008-10-12
9
4,249 Views
Last Modified: 2013-12-13
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...
0
Comment
Question by:medfacit
  • 5
  • 4
9 Comments
 
LVL 6

Expert Comment

by:thebradnetwork
ID: 22700238
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
0
 

Author Comment

by:medfacit
ID: 22700497
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.
0
 
LVL 6

Expert Comment

by:thebradnetwork
ID: 22700612
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
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:medfacit
ID: 22700715
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.
0
 

Author Comment

by:medfacit
ID: 22700724
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?
0
 

Author Comment

by:medfacit
ID: 22700892
Just finished trying again with the installer. Still doesn't appear to want to work. See attached picture.
phpinfo.jpg
0
 
LVL 6

Expert Comment

by:thebradnetwork
ID: 22703952
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.
0
 

Accepted Solution

by:
medfacit earned 0 total points
ID: 22706953
Thanks thebradnetwork.

I have already logged this bug with PHP

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

but was told that it was a configuration issue. Maybe it's not a huge deal having my path as C:\WINDOWS but having the loaded file as C:\Program Files\PHP\php.ini.
0
 
LVL 6

Expert Comment

by:thebradnetwork
ID: 22707023
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.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question