Geeks With Blogs

Tim Huffam Dotting the I and crossing the T of I.T.

It seems every time I try to install PHP and MySQL something doesn't work - usually there's either a file missing from the PHP distro or something in the install notes is missing or incorrect.  This time it was both.

I first tried the PHP msi install - first mistake.  As it does not include the MySQL extensions - neither does the 5.2.6 PECL zip file (I mistakenly thought this would include all the extensions).  So if you've installed PHP using the MSI installer - uninstall it (via Control Panel - Add/Remove Programs).  Also - you may need to manually remove any remants of this PHP installation manually - I had to manually delete the php directory.

Now with a clean slate do the following:

  1. Download the PHP zip package from here.
  2. Extract the zip - in my case into D:\php-5.2.6-Win32
  3. Copy php.ini-recommended and rename it to php.ini (within this same dir).
  4. Edit php.ini and make the following changes:
    1. Set the extension dir eg:
      extension_dir = "D:\php-5.2.6-Win32\ext"
    2. Uncomment the extension setting for mysql eg remove the ';' from the beginning of the line:
      extension=php_mysql.dll
  5. Within IIS admin tool:
    1. Within Application Configuration (within 'Home Directory' of a site) add the php extension - mapping 'php' to php5isapi.dll (eg D:\php-5.2.6-Win32\php5isapi.dll).
    2. Within Web Service Extensions add one for php5isapi.dll (eg D:\php-5.2.6-Win32\php5isapi.dll) setting it to 'Allowed'.
  6. Update the PATH environment variable to include the php dir eg D:\php-5.2.6-Win32.
  7. Add a new environment variable called PHPRC and set to the php dir eg D:\php-5.2.6-Win32  (this part was missing from the install docs for IIS).
  8. Restart iis (eg run iisreset from the command prompt).

Bingo - that's it. To test create a file called phpinfo.php (and place in the web root) with the following:
<?php
phpinfo();
?>

The critical part to check here is that the output of this phpinfo shows the 'Loaded Configuration File' is set to the php.ini file you created above.  If PHP is configured correctly to use mysql it this (phpinfo output) will have a MySQL section - if this is missing - then something is wrong.

HTH
Tim

Posted on Wednesday, July 2, 2008 9:18 AM PHP (incl PhpMyAdmin) | Back to top


Comments on this post: Getting PHP 5.2.6 and MySQL (and PHPMyAdmin) working on IIS 6 Windows 2003 Server

# re: Getting PHP 5.2.6 and MySQL (and PHPMyAdmin) working on IIS 6 Windows 2003 Server
Requesting Gravatar...
I am not able to see MySQL parameter in PHP info. what can be the issues ?
Left by Abhishek on Sep 08, 2008 2:05 AM

# re: Getting PHP 5.2.6 and MySQL (and PHPMyAdmin) working on IIS 6 Windows 2003 Server
Requesting Gravatar...
When you call up index.php, it gives you a host of clues. So follow the directions above to create the index.php file; put it on your server, and call it up. It executes a phpInfo() dump. The first entry from the index.php dump to look at is an entry called "Loaded Configuration File " . This tells you what file is read to initialize the environment. Obviously, your php.ini file should reside here. An entry within that file should point the "extension_dir" variable to the proper folder (i.e. the one that contains the file php_mysql.dll). To confirm that the "extension_dir" variable is properly set, scroll down the index.php page to a section called "Configuration
PHP Core". Look for extension_dir. Make sure it points to the folder/directory that contains the php_mysql.dll. That's part I. The next part involoves making sure your php.ini file (located in the directory cited next to "Loaded Configuration File") has the line extension=php_mysql.dll uncommented (i.e. NO semi-colon preceding it). Make sure 1) you type it exactly as above, and 2) that .dll file exists where you say it exists, namely where extension_dir points. Then restart iis (see above) and run index.php again. You should see a MySql section.
Left by TeacherBiker on Sep 24, 2008 4:31 PM

# re: Getting PHP 5.2.6 and MySQL (and PHPMyAdmin) working on IIS 6 Windows 2003 Server
Requesting Gravatar...
This is the first set of instructions that actually worked - first time - after over 8 hours of frustration
thank you
Left by Jerry Killion on Oct 07, 2008 9:51 AM

# re: Getting PHP 5.2.6 and MySQL (and PHPMyAdmin) working on IIS 6 Windows 2003 Server
Requesting Gravatar...

Thanks for the excellent instructions, i am a old hand at computers, hence setting up PHP and MySQL using your instructions was easy, have been struggling to get them up and running, even ended donwloading and installing WAMP at one stage.

But there are somethings you need to add to the instructions to give more clarity.

1. The link to to the zip files should possibly have a different color.

2. I am sure, not everyone knows how to add a new service in IIS, some images will be more helpful.

3. Same with setting PHPRC on the Windows System

here is an example

http://www.visualwin.com/PHP/

Thanks



Left by Jackson on Jan 20, 2009 1:19 AM

# re: Getting PHP 5.2.6 and MySQL (and PHPMyAdmin) working on IIS 6 Windows 2003 Server
Requesting Gravatar...
Thank you very much for the easy to follow instruction, i'm currently configuring a copy of my blog to my workstation.

How come they didn't include the configuration in the installer itself? I'm currently using 5.2.6 msi win 32 installer the extension is in there you just need to choose custom during installation.

Left by vhincent on Mar 23, 2009 8:36 PM

# re: Getting PHP 5.2.6 and MySQL (and PHPMyAdmin) working on IIS 6 Windows 2003 Server
Requesting Gravatar...
So, where are your instructions for PHP MySQL? I have PHP, and MySQL and GUI tools installed. All are fine.

You say that these are instructions for installing PHP, MySQL and PHP MySQL.....don't see anything but PHP. WCW
Left by Willow Wright on Mar 24, 2009 5:06 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net