Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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

Posted on 2008-10-12
Medium Priority
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...
Question by:medfacit
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4

Expert Comment

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

Author Comment

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.

Expert Comment

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.
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.


Author Comment

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.


Author Comment

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?

Author Comment

ID: 22700892
Just finished trying again with the installer. Still doesn't appear to want to work. See attached picture.

Expert Comment

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


This what I found on how to change the path


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.

Accepted Solution

medfacit earned 0 total points
ID: 22706953
Thanks thebradnetwork.

I have already logged this bug with PHP


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.

Expert Comment

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.

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Learn about cloud computing and its benefits for small business owners.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.
Suggested Courses

618 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