The Movable Type User Manual

NOTE: This documentation is for Movable Type 3.2. If you are using a newer version, please see the documentation for Movable type 3.3x or Movable Type Enterprise.

« Running Movable Type with suexec or cgiwrap | Up | Configuring A Windows Server To Run CGI Scripts »

Chapter 11: Advanced Topics

Running Movable Type With mod_perl

Problem

You want to improve the performance of Movable Type by eliminating the overhead of CGI.

Solution

Run Movable Type under mod_perl 1.x.

Discussion

mod_perl embeds a Perl interpreter into the Apache server, so that dynamic content produced by Perl scripts can be served in response to incoming requests, without the significant overhead of re-launching the Perl interpreter for each request.

Movable Type can run under mod_perl 1.x in either Registry mode or as a set of full-fledged handlers. Note that in order to run under mod_perl, you must have Apache::Request and Apache::Cookie installed; these modules comprise the libapreq distribution, which can be downloaded from CPAN.

Setting up MT under Registry is just like setting up any other CGI script under Registry; add the following to your httpd.conf:

    PerlModule Apache::Registry
    <Location /path/to/mt>
    SetHandler perl-script
    PerlHandler Apache::Registry
    Options +ExecCGI
    </Location>

You will need to host your mt-static files in another directory outside of /path/to/mt, just as if you had placed MT into the cgi-bin.

If you want even more speed, consider running Movable Type to run as a mod_perl handler. You will need to set up a handler for the main application and one for each of your public scripts.

  • 1. Set up your mt-static directory in a web-accessible path not under /mt/.
  • 2. Add the following to your httpd.conf:
        <Perl>
        use lib '/path/to/mt/lib';
        use lib '/path/to/mt/extlib';
        </Perl>
    
        PerlModule MT::App::CMS
        <Location /mt/app>
        SetHandler perl-script
        PerlHandler MT::App::CMS
        PerlSetVar MTConfig /path/to/mt-config.cgi
        </Location>
    
        PerlModule MT::App::Comments
        <Location /mt/comments>
        SetHandler perl-script
        PerlHandler MT::App::Comments
        PerlSetVar MTConfig /path/to/mt-config.cgi
        </Location>
    
        PerlModule MT::App::Trackback
        <Location /mt/trackback>
        SetHandler perl-script
        PerlHandler MT::App::Trackback
        PerlSetVar MTConfig /path/to/mt-config.cgi
        </Location>
    
        PerlModule MT::App::Search
        <Location /mt/search>
        SetHandler perl-script
        PerlHandler MT::App::Search
        PerlSetVar MTConfig /path/to/mt-config.cgi
        </Location>
    
        PerlModule Apache::XMLRPC::Lite
        PerlModule MT::XMLRPCServer
        <Location /mt/xmlrpc>
        SetHandler perl-script
        PerlHandler Apache::XMLRPC::Lite
        PerlSetVar dispatch_to "blogger, metaWeblog, mt"
        PerlSetVar MTConfig /path/to/mt-config.cgi
        </Location>

    Note that, as an alternative to the use lib statement above, you could also use

        PerlSetEnv PERL5LIB /path/to/mt/lib
  • 3. In your mt-config.cgi file, you will need to use the following settings:
        CGIPath http://my.server.com/mt/
        StaticWebPath /mt-static/
        AdminScript app
        CommentScript comments
        TrackbackScript trackback
        SearchScript search
        XMLRPCScript xmlrpc

    StaticWebPath should correspond to the URI you set when setting up your mt-static directory in Step 1.

    If you are using BerkeleyDB, you also need to add the following in addition to the lines above:

        DataSource /path/to/db

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated; but please do not use the feedback form to submit support requests or question. We will not respond to or publish such queries submitted through this form. If you have a technical question or problem, visit Movable Type Support.

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.