Jump to content

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


Recommended Posts

I am trying to upgrade PHP from 5.2.6 to 5.3.2.  I have created a directory C:\php5 and placed PHP in this directory including the php.ini file.

 

I have added C:\php5\ to the system's PATH variable and created a new variable called PHPRC to which it's value was set also to C:\php5\.

 

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:\php5\php.ini

 

Although I have the mysqli extension uncommented, I seem to unable to load this extension and use it.  At least, I think that's what's going on because when I fire up phpMyAdmin (which used to work fine on 5.2.6) I get the following error:

 

Cannot load mysqli  extension. Please check your PHP configuration.

 

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

 

Thanks!!!

Link to comment
Share on other sites

The Loaded Configuration File is all that you need to be concerned with (you would need to recompile php to change the Configuration File Path value.)

 

Did you reboot your computer to get any change made to the Windows Path statement to take effect and did you stop and start your web server to get any change made to php.ini to take effect?

 

Also, what method was used to install 5.2.6, because that can have an effect on php settings and on installing extensions (i.e. the msi installer puts settings into the Windows registry that prevents settings you put into the php.ini from working.)

Link to comment
Share on other sites

Did you reboot your computer to get any change made to the Windows Path statement to take effect and did you stop and start your web server to get any change made to php.ini to take effect?

 

Yes - I rebooted (and restarted the Apache server).

 

Also, what method was used to install 5.2.6

 

Honestly, I have no idea.  It was so long ago!  But here's what I did to try the upgrade...

 

Basically, my 5.2 was in a "php5" folder as well.  So I just renamed THAT folder to "php5-old" and then made a new empty "php5" folder.  Then I took the 5.3 zip package and unzipped it to the new empty "php5" folder.  I did this so that all the associations (PATH variables, Apache config, etc) would still remain pointing to the same place.  Then I took all the settings that I changed from the old 5.2 ini file and made the changes in the new 5.3 ini file.  Finally, I copied the "libmysql.dll" file into the new "php5" folder and the "php_mysql.dll" and "php_mysqli.dll" files into the "php5/ext" folder.  Then I rebooted, and that's where I stand.

 

Where am I going wrong?  If I change my current "php5" folder to "php5-new" and make the "php5-old" folder back into "php5", then I restart Apache and everything's fine again.  In phpinfo() the "Configuration File (php.ini) Path" also, then, says "C:\php5\php.ini" and the mysqli extension is functioning/enabled again (neither of which are the case when I have the 5.3 files in the "php5" folder).

 

Oh - also, I'm on Apache 2.0 (not 2.2) if that matters.

 

Thanks!

Link to comment
Share on other sites

Finally, I copied the "libmysql.dll" file into the new "php5" folder and the "php_mysql.dll" and "php_mysqli.dll" files into the "php5/ext" folder.

 

What? The two files you mentioned should have always been in those locations because the correct version of them come with the .zip package.

 

Did you also set the extension_dir = setting to point to your ext folder?

 

Also, php5.3 comes with a native mysql driver and it is no longer necessary to use the libmysql.dll.

Link to comment
Share on other sites

What? The two files you mentioned should have always been in those locations because the correct version of them come with the .zip package.

 

Also, php5.3 comes with a native mysql driver and it is no longer necessary to use the libmysql.dll.

 

Oh - I had no idea about any of this!  How can I rectify what I've done, then?  Should I just unzip the whole 5.3 package into the "php5" folder and start over, just not doing anything with any of the .dll files?

 

Did you also set the extension_dir = setting to point to your ext folder?

 

Yeah - I did that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.