Monday, September 01, 2008

[log] How to install PHP 5 and MySQL 6 on IIS 6 Windows Home Server

Installed PHP and MySQL on Windows Home Server with IIS6 this weekend, in order to install Wordpress and Gallery. As expected, it was all about figuring out confusing and non-existant installation instruction. Recap of how I should do it (if there is a next time).

[ PHP 5 ]

1. Download and run installer
- Go to PHP download page: http://www.php.net/downloads.php
- Download the Installer (php-x.x.x-win32-installer.msi)
- Download and Zip pakcage (php-x.x.x-win32.zip)
- (Why two packages? The installer saves time by automatically settig a bunch of IIS settings. But the zip file has all the DLLs that we need to add in)
- Double click to run the installer. Use all the default settings it suggests. Choose ISAPI, when it asks about it.

2. Copy DLLs
- In an explorer window, navigate to c:\program files\php\ext (The installer would have created this folder if you used the default setting)
- In another explorer window, navigate into the zip package (php-x.x.x-win32.zip).
- In yet another explorer window, navigate into c:\windows\system32
- Copy php-x.x.x-win32.zip\libmysql.dll into c:\windows\system32
- Copy php-x.x.x-win32.zip\ext\*.* into c:\program files\php\ext
- (Probably won't use all the extensions, but it's much easier to have them in there to just activate in php.ini file in the future)

3. Setup php.ini
- Open c:\program files\php\php.ini in a text editor
- Find the right section by searching for "extension="
- Add these lines:
- extension=php_mysql.dll
- extension=php_gd.dll
- extension=php_gettext.dll
- (mysql is for both wordpress and gallery. gd and gettext are for gallery only)
- As a last check, search for "extension_dir" and make sure it's set to c:\program files\php\ext. If it isn't, fix it.

4. Add index.php as a default content file
(This step is critical for all the PHP apps like wordpress and gallery)
- Start Menu -> Programs -> Administrative Tools -> Internet Information Services
- Expand the first level (which is something about "local computer")
- Then expand the "Web Sites" folder, now you should see "Default Web Site"
- Right-click on "Default Web Site"
- Click on the "Documents" tab
- Click "Add" button and type in "index.php"
- Click "Apply" and then close all the windows

5. Reboot the machine
- Tried just with IISReset, but IIS could not find php.ini in the right directory. So I rebooted the machine and that worked.

[ MySQL 6]

1. Go to http://dev.mysql.com/downloads/mysql/6.0.html#win32
2. Download the "Essential", which has the file name that looks like mysql-essential-x.x.x-win32.msi
3. Double click to run the installer. Use all default settings.
4. Reminder -- Write down the admin password. You'll need to log in as admin later to create databases and users to install things like wordpress.

PHP and MySQL by themsevles are not all that interesting. Make them useful by installing some applications. Here's how to install Wordpress on IIS 6 Windows Home Server.