> the protogenLabs notebook » reading full entry…

Jul
24

Fixing a php.ini configuration file problem

» posted 565 days ago @ 07:41 PM by George Merlocco in Web / Technology

post this to Digg
share this on Facebook
post this to del.icio.us
post this to Ma.gnolia
post this to Technorati
post this to Reddit
post this to Windows Live
post this to StumbleUpon
post this to Google Bookmarks

Though not too many people run PHP on top of IIS, (it's usually Apache, or LAMP) I am one of the few who does. I recently underwent setting up a proper development environment. This of course included installing PHP 5 and MySQL 5 onto IIS7 (within Windows Web Server 2008). I followed this guide which resulted in a successful integration of PHP within IIS7. Also note that if you are installing PHP onto Windows Server 2008 or IIS7, do NOT use the "Windows Installer" to set it up. Instead, grab the .zip file of all PHP files, and run through the manual installation procedures.

Anyways, on to the actual issue that I was experiencing, which caused me to reinstall Windows and waste about 5 hours of my precious life ;) I had PHP working, but the MySQL extension was not being loaded, specifically "php_mysql.dll". I thought everything was fine and dandy because when I ran a simple PHP_info test page that contained:

< ?php phpInfo();? >

I was greeted with the PHP configuration settings, however what I had failed to notice the first time was that some variables were not set correctly:

Configuration File (php.ini) Path = C:\Windows
Loaded Configuration File = (none)

It had seemed that even though I had added "C:\PHP" to my Windows Server 2008 System Variables in the PATH section, PHP was still not seeing my php.ini file which was really in C:\PHP. There was NO php.ini file in C:\Windows either. After wrestling with this for hours, I gave in and tried putting php.ini in C:\Windows, as well as having it in C:\PHP. For some unknown reason, PHP finally began to work, and I saw my php_mysql.dll file being loaded successfully. I know that this is NOT the preferred way, as you really want to keep all of your PHP files contained to the one directory, but there just wasn't a way to get this working without tearing ALL of my hair out.

If you wanted to follow up on the issue to see if the PHP team has fixed this bug, keep an eye on the official bug page. I hope this helps anyone who's run into this issue. If you have, please post your experience below, and let us know if there's anything else you've done to fix it!


comments 3 comments submitted  article's permanent link permalink  add to your social bookmarks bookmark this  hop to the top^ back to top
article tags article tags: , , ,

> [3] article comments…

1

Server 2008 has same problem

by Mike on 05.19.2009 @ 12:16 AM » #

2

I installed php with ISAPI in Windows Server 2008.
It went so bad that there was 404 error if the PATH was set in Environmental Variables. PHP worked fine when C:\PHP was removed from the PATH variable.

I put php.ini in C:\windows and it worked well. But still I can’t change the “Configuration File (php.ini) Path”

by d_shre on 10.06.2009 @ 05:07 AM » #

3

Hmm same problem here but with Windows 7, can’t load the extension=php_mysql.dll because the php.ini file is not being read for some reason.

Tried copying it to C:\windows as well as c:\php and no luck :(

any ideas?

by zag on 12.10.2009 @ 10:35 AM » #

> leave a comment?

Name:


E-Mail:


Website:


Comment: