I’m working on a design update for the old ‘bottle, and I’m going to do it on Movable Type 4, which is now on Release Candidate 4 as I write this, and looking good.

I’ve decided to use XAMPP, an easy-to-install Apache distribution containing MySQL, PHP and Perl, which just works, basically, on Windows, no tweaking necessary (I’m still on XP2 SP2, despite being an early adopter of all Microsoft’s previous OS’s, which is a whole different story.) xampp.gifBy exporting the data from this site using the old MT 3.3 export tool, importing it to a local copy of MT running on my machine here at home, I can develop and tweak everything a lot more quickly, and there’s no risk of borking the actual site while I work out the kinks with the new design and the new template structure in MT4, which I’m excited (yes, I’m a geek) to fiddle with.

There are a couple of tutorials out there for getting MT working locally, but none of them actually worked for me by following their instructions, so after hours of fiddling, now that I’ve got it working, I thought I’d share The Secrets. Well secret if the ways of webservers are as arcane to you as they are to me.

The first few steps are easy.

1) Download XAMPP and install it. I installed it to c:\xampp\ to avoid funkiness with long filenames with spaces in them. [Update: word on the streets is that MT will crap itself if you try use to use a path with spaces in it, so c:\Program Files\ is probably a bad idea. Best to stick to c:\xampp\, unless, like me, you’re a little compulsive about a clean root directory.]

Choose “No” (you can change this later) when asked to install as a service and “No” when asked to start the Control Panel.

2) Download the PERL 5.8.8-2.2.4 Add-on and install it. (This was the step that was missing from all the other tutorials I saw, and cost me hours of hair-pulling).

Double click the desktop icon and hit the appropriate buttons to start Apache and MySQL. Go to http://localhost in your favorite browser to see if everything’s working. It should be fine. If you see the friendly orange XAMPP home page, you’ve got a working local web server.

2) Download the latest release of Movable Type and unzip it somewhere temporary.

3) Make a folder called ‘mt’ (no quotes) in your c:\xampp\cgi-bin\ folder (if you installed to the same location as I did (I’ll assume henceforward that you did)).

4) Copy all of the Movable Type files (except the folder called ‘mt-static’) to that new location (ie c:\xampp\cgi-bin\mt\). Copy the ‘mt-static’ folder to c:\xampp\htdocs\ instead.

5) Edit the mt-config-original.cgi with Notepad or your favorite text editor. Mine looks like this:


CGIPath    http://localhost/cgi-bin/mt/
StaticWebPath    http://localhost/mt-static
##### MYSQL #####
ObjectDriver DBI::mysql
Database mt
DBUser root
DBHost localhost

I’ve deleted the alternate database lines after what you see here. You can do the same, or comment out the lines with ‘#’. Save the file as mt-config.cgi (omitting the ‘original’ part).

6) Edit all of the rest of the .cgi files (other than the one you just edited) that are sitting in your c:\xampp\cgi-bin\mt\ folder. These are mt.cgi, mt-add-notify.cgi, mt-atom.cgi, mt-check.cgi and so on.

The first lines of each file will read

#!/usr/bin/perl -w

. Change them to (again, if you’re using the same install path as me)

#!C:/xampp/perl/bin/perl -w

in each case and save the files.

7) Go to http://localhost/cgi-bin/mt-check.cgi in your browser. If all is well, it’ll run some tests, and come back to tell you all is well to proceed.

8) Go to http://localhost/cgi-bin/mt.cgi and fill in the forms with a username and password and so on. Note: if the forms are unstyled, you’ll need to check that your path in mt-config.cgi is pointing correctly to your mt-static folder.

9) A few seconds later, you should be up and running in MT4 on your local machine. Yay!


Join the conversation! 2 Comments

  1. get a mac!
    ok, you can’t get a mac any more. you can only get mac os x.
    still, then you could do:
    for FILE in \xampp\cgi-bin\mt\*.cgi
    cat $FILE | sed ‘s?#!/usr/bin/perl -w?#!C:/xampp/perl/bin/perl -w?’ > $FILE.new \
    && mv $FILE $FILE.old \
    && mv $FILE.new $FILE \
    || echo “!! OMGWTF!! problem with \xampp\cgi-bin\mt\$FILE”
    simple. obvious.
    honestly, i worry about you windows people. mac is so much easier.

  2. hmph. indenting died. add a couple of spaces to start of each line b/w “do” and “done” for improved obviousity.

Comments are closed.