Solved

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

Posted on 2008-10-12
9
4,212 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:medfacit
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:medfacit
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress type image upload 10 26
Button Click 11 24
Wordpress Body Class 5 9
Help cleaning out CSS 2 23
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now