Drupal on IIS in Windows: Easier Done than Said
There’s two ways you can get up and running quickly using Drupal on the Microsoft Web Platform. You can either use the built-in Acquia Drupal that is part of the Microsoft Web Application gallery in WebMatrix, or you can use WebMatrix to install directly from the source.
If you want to use a custom distro, or the latest bits from Drupal.org, I recommend the latter, and here I’m going to step through how easy it is to get there. This assumes that you’ve already installed WebMatrix, which makes it very easy to do many of the tedious little tasks that are usually involved in building sites or using open source, even if it uses source like PHP.
You can find it on the Microsoft Web Platform site.
Step 1: Install Dependencies
Make sure that you have the MySQL and PHP dependencies installed properly on your Windows development box. If you don’t have them, or if you are unsure whether you have them or not, go ahead and install a PHP-based open source application using the WebMatrix Web Application gallery. It doesn’t matter which one, as long as it uses MySQL and PHP. You could even install Acquia Drupal if you like, which I have done in this case, and created a database user called ‘
Note: When you are installing MySQL, you’ll be asked for the admin (‘
root’) password. Make sure you remember this, you’ll need it soon.
Step 2: Create the Drupal Database
Download PHPMyAdmin from www.phymyadmin.net. Unzip it onto your desktop and right click on the folder. You’ll see the option to ‘Open as a Web Site with WebMatrix’.
This is a really neat aspect of WebMatrix – the ability to turn any folder into a site instantly, without you needing to go hunting for ‘
htdocs’ or ‘
wwwroot’, and without needing administrative access to write to it. Press the run button from within WebMatrix and your PHPMyAdmin site will launch.
Select the ‘Databases’ tab, and at the bottom of the screen, type ‘
drupal’ in the ‘Create new database’ section. Change the collation setting to ‘
Press the ‘Create’ button and you now have a new database.
At the top of the screen, you’ll see a breadcrumb trail that has ‘
localhost’ as a link. Click this to go back to the home screen.
Select the Privileges tab, and add a new database user. In the center of the screen, you’ll see a ‘Add a new user’ link.
Select this and you’ll be taken to the new user info screen. Give them a name and password and assign them to the ‘Local’ host as shown here:
Note that if you click Generate Password, you’ll get a random, secure, but hard to remember password!
Scroll down to the bottom of the screen and find the ‘Go’ button. Press it.
On the next screen, scroll down to the ‘Database-specific privileges’ section, and select ‘drupal’ as the database. The screen will refresh, and you’ll be asked to set the privileges for this user. Do them as shown, and press ‘Go’.
You’ve now created an empty database for Drupal, and a drupal specific user that Drupal can use to sign into and use your database. Next step is to get Drupal itself.
Step 3: Download and Configure Drupal
The latest and greatest version of Drupal, at the time of writing can be found at: http://drupal.org/drupal-6.19.
Drupal is downloaded as a .tar.gz file, which, if you’re a Windows user doesn’t work out of the box. However, you can quite easily download the free 7-zip application that allows you to use this file type and use Drupal.
You’ll unpack it as a directory, and as earlier, you can right click on this to get WebMatrix to open it as a Web site.
Do not run the site yet. Instead, use the File explorer in WebMatrix to find the sites/default directory. Right click on this and select ‘Show in Windows Explorer’.
Make a copy of the default.settings.php file that you see in this directory and call it settings.php.
Now, within WebMatrix you can run the site, and you’ll see the Drupal install screen.
Step 4: Install Drupal
The final step is to install Drupal. Select your language, and you’ll be taken to the Database configuration screen. Fill this out with the correct values – the Database name is the name of the database you created in step 2 (i.e. ‘drupal’), and sign in with the Drupalguy name and password.
Drupal will go through its initialization, and you’ll be taken to the site configuration dialog. Use this to set up the administrator account and email settings. At the end, when you ‘Save and Continue’, you’ll hit an error where Drupal can’t find a mail server on ‘localhost’…that’s because you likely don’t have one, so don’t worry about it for now.
Click the ‘your new site’ link, and you’ll be taken to your new Drupal site.
Well done! You’ve just installed Drupal on your Windows box, running on IIS using PHP, and editable via WebMatrix. All in all, this took about 30 minutes, including downloading time over broadband, but Drupal is running very happily on my IIS Web server!
- 4th October, 2010: Initial post