« Upgrading to Movable Type 4 with MTCommentFields | Main | Make Flickr's Blog This Feature Work with Movable Type 4.0 »

Install Movable Type Under Windows (IIS)

Though the vast majority of installations I work with use LAMP (Linux, Apache, MySQL, Perl) to run Movable Type, there are also a few where my client would like to place Windows in that equation. While it's a possibility to run Apache on Windows, Internet Information Server (IIS) has shipped with Windows Servers just about forever, and it's quite possible to get Movable Type up and running without Apache. I guess you might like to call this a WIMP (Windows, IIS, MySQL, Perl) installation, which fits in nicely with the old Windows, Icon, Mice, Pointers joke from years back. But I digress.

First, of course, you need Windows and IIS. Unfortunately, configuring those two is going quite beyond the scope of this article. Luckily, doing so is not particularly difficult. You'll also need, at a minimum, MySQL and Perl. If you want to use dynamic publishing, you'll also need PHP - but I'm not going to cover that here. Maybe next time. Ready? Let's go!

I should probably cover a few questions. First, MySQL and Perl.

MySQL is a database. If you're familiar with Microsoft products, then it's somewhat similar to Microsoft SQL Server - but it's free, and Movable Type stores all of its data inside. There is a version of Movable Type that runs on SQL Server, and it's called the Enterprise version. That's also not covered here. This is for the standard product only, though some of the details might be of use to you.

When you go to get MySQL, you want the community version. You can get the Enterprise version if you want, but it's not needed. From the link above, download the MySQL Community Server. The Enterprise version should work, but you'll have to buy it one day (the Enterprise version is not free software). You should also download the MySQL GUI Tools. These aren't strictly required, but if you're used to Windows, chances are you like working in Windows, not at the command line, so it's nice to have them available.

Perl is a programming language. Specifically, it is the language that Movable Type is written in, and in order to run Movable Type, you must have Perl. The link above takes you to the download location. You don't even have to provide your contact details, but you can if you like.

Once you get both MySQL and Perl installed (the installation is fairly straightforward for Windows applications), you're ready to proceed. Also install the GUI tools if you downloaded them. Download your Movable Type installation and unpack it to a directory where you'll store it. Generally this will be called something easy to remember, like mt, and can be found inside your wwwroot directory, along with your other website files.

You will likely need to install two modules before Movable Type will work. This process is started from the command line. Click Start, then Run, then enter CMD and press ENTER. At the command line, type ppm (unlike most *nix systems, Windows is not case-sensitive, so you can actually type ppm, PPM or even PpM and it should work fine) and press ENTER. This starts a graphical installation utility.

The process will take a moment to synchronize the database. When it is done, you will be presented with a list of all installed modules. Click the View menu item, then select All Packages. In the search box, enter dbd-mysql (case is not important).

You should see three packages listed - DBD-mysql, DBD-mysql-SimpleMySQL and DBD-mysqlPP. Next to each are three columns: area, installed and available. We want to see if DBD-mysql is installed. It probably is not. Click the row that contains DBD-mysql to highlight it, then click the box with a plus on it, next to the search box. This marks it for installation.

Next, click in the search box and search for mail-sendmail. Like DBD-mysql, it is probably not installed. Again, click the row to highlight it and then click the box with a plus on it to mark it for installation.

Now we just need to install the modules that were not installed. Click the File menu option, and select Run Marked Actions. This will install those items you have marked. If everything goes as planned, you will now have two new modules installed! If not, try these steps again to see if you can get them to work. If it doesn't you may need some help that can't be addressed here.

Once the modules have been installed, you're done here. You can exit ppm and close the command-line window.

Open the MySQL Query Browser by going to Start, then MySQL, then selecting MySQL Query Browser. You'll be prompted for a login. Specify the user name and password that you gave when installing MySQL earlier. You will also need to provide a default schema. This is simply the default database that you'll be using. Enter mysql for now. So long as it's valid, it doesn't really matter what you specify here.

Once connected, you need to create your new database. We'll call it mt. In the query window (at the top), enter create database mt; (note the semicolon at the end) and click the Execute button. This creates the database for you. You can now exit the MySQL Query Browser.


With the applications configured and the database ready to go, there are only a few items left. First up is updating the Movable Type configuration file. For this, you need to locate the file, which you will find in the mt directory that you created earlier. The name of the file is mt-config.cgi-original. Before doing anything, copy this file to another name - mt-config.cgi (drop the -original from the end). Then edit this new file.

The first line in the file to edit is the CGIPath declaration. This indicates where Movable Type is found, and should be either a full URL or a relative URL (without the domain). Most Windows systems don't use a cgi-bin, so the example is probably not going to be correct. That doesn't stop you from using one, but you don't need one either. Here's the example, simply make the necessary changes to what it will need to be once the site is live:

CGIPath http://www.example.com/cgi-bin/mt/

The next line to configure is the StaticWebPath directive. Because Windows systems rarely use the cgi-bin, and if they do, it's not restricted like it is on *nix systems, the use of this is often simply commented out (just put a # sign in the front). You can use it, but for simplicity, I won't address it here. Your should look like this:

#StaticWebPath http://www.example.com/mt-static

Now you need to configure your database. This actually requires five values. The first will not change with this configuration - we are always using DBI::mysql. The second is going to be the name of the database that we created above (we used mt, if you use something else, replace it here). The third is the username you created when you set up MySQL and the fourth is the password for that user. The last value is the host - localhost since the database is on the same computer as the site. If you move the database, this would point to that location.

ObjectDriver DBI::mysql
Database mt
DBHost localhost

The final step is actually an optional one, and that is if you want to send notifications. To do this on Windows, we must use SMTP (actually, there are other ways, but this is by far the easiest). Simply specify two more directives in the file:

MailTransfer smtp
SMTPServer localhost

If for any reason the SMTP server is not running on the local computer (for instance, if it's another system), just specify that value instead.

Now, save the mt-config.cgi file.

Almost there - start your IIS Manager. Usually this is done by going to Administrative Tools and then selecting Internet Information Services (IIS) Manager, but you may have a shortcut on the desktop or in the quick launch bar. However you get there is fine. Open the web site where Movable Type will run, whether it is the Default Web Site or another one.

Expand the web site and locate the mt directory. Right-click on the mt directory and select Properties. Click the Configuration button. In the Application Extensions list, scroll down until you reach cgi (it should be between cer and config). It may not be there at all. If you don't see it, you'll need to add it. If it is there, you'll need to edit it. In other words, if you don't see it, click Add. If you do see it, highlight it and click Edit. You want to make the extension look like this mapping.


That means you need to specify the path to the executable - which should be C:\Perl\bin\perlis.dll, the verbs, which are limited to GET,HEAD,POST and check both boxes. There are some references that you should map the cgi extension to the Perl executable rather than the dll. However, there are two reasons why I would suggest that you don't do this. First, the performance with the dll is better. Second, MT4 does not work with the executable. I can't tell you why, as I have been unable to figure it out - but it works with the dll version whenever I've tried. Add to that improved performance, and I'd stick with the dll.

Click, OK to save the mapping, OK to save the Configuration and OK to apply the properties. Almost done.

Scroll all the way to the bottom of the IIS Manager window (left side). You'll see an item called Web Service Extensions. Click it. On the right side, it will list two items for Perl - one for Perl CGI Extension and one for Perl ISAPI Extension. The first is if you decide to use the executable version of Perl. The second is if you use the dll version. Since we're using the dll version, we're using the second. But if you've gone with the executable, you want the first. Keep that in mind.

Since we want the second, click the second (that would be Perl ISAPI Extension) and then click Allow. That's it. Now stop and start your web site, just to make sure that it picks up all the changes that you've made.

To test out your configuration, visit the mt-check.cgi page by loading it in a browser. This will be at the CGIPath location you set earlier, along with mt-check.cgi at the end. So it should look something like this:


If everything works as expected, then all the checks should work. You will get a few that will fail, but you'll have enough that you can run the installation. Just remove the -check (that is, connect to mt.cgi) and you'll be prompted to run the installation procedure.

There's a lot of detail here, but mostly that's to make sure that everything is covered. Read it over and try it out - you'll realize that it's really not that complex.

This tutorial is written by LMT author Chad Everett of Everitz Consulting.
Tutorial cross posted on Don't Back Down and LMT.