Friday 27 September 2002

MT+MySQL·PHP: 01 (Introduction)

Over the next few weeks I’ll be moving my Movable Type weblog from an Australian Web hosting service in Australia to one in the USA. My esteemed compatriot, Allan Moult, and I intend to document the process as thoroughly as we can. I’ll be writing from the perspective of a Windows desktop user while Allan will cover the Macintosh OS X issues.

Our hope is that these posts will be useful not just to other MT users in a similar situation, but to anyone interested in getting MT to run on an Apache/MySQL/PHP system.

Disclaimer: We’re not claiming to be experts, just reasonably savvy Movable Type users with a few runs on the board. In the (likely) event that either of us makes an error, we’re confident that more experienced souls will jump into our comments and point out where we’ve run off the track. When that happens, we’ll acknowledge the mistake in a comment and correct the actual post.

My site is currently hosted on a Win2K/IIS 5.0 server. Though I cannot fault the service, which has been responsive and competent, the installation was not straightforward and I only later discovered I could have MySQL database support by moving up to a US$150 per month hosting plan. I asked for alternatives before settling on Cornerhost, with whom I’ve been absolutely delighted. Other hosting services came just as highly recommended so you shouldn’t have any trouble finding one that suits. As long as you follow Recommendation #01:

Under no circumstances should you willingly pay for anything but hosting on a UNIX/Linux Web server.

Many of the problems that I and others encountered in installing and using Movable Type are a consequence of running the software on an IIS server. In those situations where you must install on IIS, an approachable, flexible Systems Administrator is highly desirable.

Your hosting plan should also include MySQL and PHP support, for reasons that I’ll make clear as this series continues. If you are installing Movable Type from scratch, this may not seem so important—but I promise you it will pay dividends quite quickly. If you are migrating an MT system that’s been using Berkeley DB as the database, you’ll find that MySQL makes life a lot easier.

I won’t cover installing MT in detail because the installation notes are thorough and easy to follow. The only glitch I encountered was in following the recommendation to:

Upload these files/folders in ASCII mode: docs, lib, mt.cfg, styles.css, tmpl, and all of the CGI scripts (mt.cgi, etc.).

Upload these files/folders in Binary mode: images.

When I did this, I found that the Linux server modified the files uploaded in ASCII mode. I compared an uploaded file with its original and, apart from some additional blank lines, they were identical. I checked with the tech support people at FTP Voyager (my FTP client) and they advised me to use Binary tranfers for everything. Why is this important? Because FTP Voyager’s powerful synchronization feature is rendered useless if the file sizes change during the transfer. (Other Windows FTP clients, such as WS-FTP Pro and Cute FTP Pro also synchronize.) And, when you’re installing MT or phpMyAdmin, file synchronization makes it easy to check that all the necessary files are in place.

Once I’d sorted out the file transfer issue, I was able to install Movable Type on a UNIX server in less than an hour, and I’m the kind of person who reads and follows the instructions religiously. Of course. you’ll need to ask your hosting provider to set up a MySQL database ahead of time. I asked Michal Wallace at Cornerhost to set up both of the MySQL databases that are included in my US$200 per annum hosting plan. I’m using one as a test database to iron out the wrinkles in the export/import process and I’ll use the other as the actual weblog database.

In the next installment I’ll cover installing phpMyAdmin, a browser-based administration interface for MySQL databases. For security reasons, it’s prudent to use .htaccess to password protect the phpMyAdmin interface and, coincidentally, Dorothea Salo today explained .htaccess in one of her typically thorough, easy-to-follow technical posts. Dorothea didn’t deal with password protecting a page or directory with .htaccess and I don’t want to cut across what she’s got planned. But, between the two of us, we should be able to cover it thoroughly. Why is it important? Because you don’t want strangers fussing with your MySQL backend.

Once we’ve secured the phpMyAdmin installation, I’ll show how phpMyAdmin can enable you to reinstall Movable Type in a matter of minutes, thereby enabling you to more quickly debug the process of importing your existing posts.

Update.

The problem mentioned by Burningbird in the comments—about the version of MySQL that your hosting service is running—seems to be specific to Movable Type’s Latest Comments feature and is covered in this thread on the Movable Type Support Forum. If you’re not using this feature to display your last n comments, then you probably don’t need to worry about it, though I’ll be checking this with Michal at Cornerhost.

And, I’m pleased to announce that Allan Moult has posted his first entry, so we’re well and truly up and running.

Allan suggests hosting your blog “one level [or folder] down from your public html path, ie, www.yourdomain.com/blog/ so that we can keep installation easy.”

The alternative to that is to set up a subdomain so that your weblog address is weblog.yourdomain.com (mine is weblog.delacour.net). The advantage of doing it this way is that you can take advantage of Google’s free search, which I’m currently using. However, if you intend to use Jay Allen’s MT Search (which will be integrated into the next release of Movable Type), then either style of blog URL will work well.

Permalink

Comments

Go ahead and talk about password-protection via .htaccess; I had no plans to.

Sent you email, but I'm still not sure my mail is getting to you.

Posted by: Dorothea Salo on 27 September 2002 at 11:10 PM

No, I'm not receiving it. You might try sending a message to delacour@kokoro.com.au. I really don't know what's going on, since all my other mail seems to be coming through OK.

Posted by: Jonathon Delacour on 27 September 2002 at 11:17 PM

Well, that is right freaky. I'll try from a different address also. You must have thought me terribly rude for not answering your mail.

Posted by: Dorothea Salo on 28 September 2002 at 12:09 AM

so which part of this post is PC-relevant? I'm in the same position as you -- thinking about upgrading to the PHP version of MT, since I'm using PHP on my server anyway, and SQL is included in my hosting plan at hostiginition.com. Thanks for offering up your notes -- what a great idea! I'm using a Mac, though, so I'm not sure which parts of your post to follow to the letter. :)

Posted by: sarah on 28 September 2002 at 05:45 AM

I think this is a very generous exercise on yours and Allan's part. Mind the version of MySql, though. You must have the most recent version of MySql (3.23.52) installed as Ben is using a fairly unusual SQL outer join that requires the newest version. MT will seem to work fine with slightly older versions, until you start having problems with comments.

And the newest version of MySql on FreeBSD isn't compatible with PHP's MySql access.

Posted by: Burningbird on 28 September 2002 at 06:27 AM

Sarah, the only Macintosh specific parts of this post were the references to Windows FTP clients. Allan Moult will deal with the Macintosh issues on his blog - http://www.cobbers.com/am/ - and we will crosslink to each other's posts.

Posted by: Jonathon Delacour on 28 September 2002 at 01:58 PM

Ahem:

http://huntformtdocs.burningbird.net/archives/000555.html
http://huntformtdocs.burningbird.net/archives/000556.html

Posted by: Burningbird on 29 September 2002 at 11:23 AM

Just wanted to mention that FTPShell Client for windows also has a very powerful compare and synchronize feature.

Other features like task scheduling, simultaneous connections to multiple sites, server to server transfers, remote file search, FTP scripts,
compression, unzip, and direct editing are also supported.

BTW, thanks Jonathon for the great article.

Regards,
John
http://www.ftpshell.com/

Posted by: John on 14 March 2003 at 05:07 PM

This discussion is now closed. My thanks to everyone who contributed.

© Copyright 2002-2003 Jonathon Delacour