Introduction to mod_perl (part 2): mod_perl Quickstart (
Page 1 of 8 )
Last week you found out all sorts of good things about mod_perl, but you may be wondering how you get started using it. Let this article be your guide.In the previous article, I've shown quite amazing web performance reports from
companies that have deployed mod_perl heavily. You might be surprised but you
can quite easily get similarly amazing results if you move your service to
mod_perl as well. In fact, getting started with mod_perl shouldn't take you more
than 30 minutes, the time it takes to compile and configure the server on a
decent machine and get it running.
In this article I'll show step by step
installation and configuration scenarios, and chances are you will be able to
run the basic statically compiled mod_perl setup without reading any other
documents. Of course you will want and need to read the documentation later, but
I think you will agree with me that it's ultimately cool to be able to get your
feet wet without knowing much about the new technology up-front.
The
mod_perl installation was tested on many mainstream Unix platforms, so unless
you have some very non-standard system you shouldn't have any problems when
building the basic mod_perl server.
If you are a Windows user, the
easiest way is to use the binary package available from
http://perl.apache.org/distributions.html.
From the same location you can download the Linux RPM version and CVS snapshots.
However I recommend to always build the mod_perl from source, and as you will
see in a moment, it's an easy thing to do.{mospagebreak title=Installing
mod_perl} So let's start with the installation process. If you are an
experienced Unix user, you need no explanation for the following commands. Just
copy and paste them and you will get the server installed.
I'll use a %
sign as the shell program's prompt.
% cd /usr/src
% lwp-download http://www.apache.org/dist/httpd/apache_1.3.20.tar.gz
% lwp-download http://perl.apache.org/dist/mod_perl-1.26.tar.gz
% tar -zvxf apache_1.3.20.tar.gz
% tar -zvxf mod_perl-1.26.tar.gz
% cd mod_perl-1.26
% perl Makefile.PL APACHE_SRC=../apache_1.3.20/src \
DO_HTTPD=1 USE_APACI=1 EVERYTHING=1
% make && make test && make install
% cd ../apache_1.3.20
% make install
That's all!
What's left is to add a few configuration lines to
httpd.conf, an Apache configuration file, start the server and enjoy
mod_perl.
If you have stumbled upon a problem at any of the above steps,
don't despair -- the next section will explain in detail each and every
step.