Running Movable Type under mod_perl
Mod_perl is an Apache Web Server module that creates a stateful and persistent application environment for Perl based web applications. The module works by loading the Perl interpreter into Apache’s memory so that the cost of loading the interpreter is incurred only once. This is in contrast to how normal CGI is handled, which loads the perl interpreter for each request.
Warning: Movable Type 5 is tested with FastCGI(mod_fcgid) . It is recommend to use FastCGI instead of mod_perl
Using this module can result in dramatic performance improvements for Movable Type.
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 modperl 1.x in either Registry mode or as a set of full-fledged handlers. Note that in order to run under *modperl, you must have
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.
- Set up your mt-static directory in a web-accessible path not under /mt/.
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 libstatement above, you could also use:
PerlSetEnv PERL5LIB /path/to/mt/lib
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
StaticWebPathshould 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: