This chapter is about getting started with mod_perl, for the very
impatient. If all you want is to run your existing CGI scripts in a
mod_perl-enabled environment, we'll try to make this
as easy for you as possible. Of course, we hope that
you'll read the rest of the book too. But first, we
want to show you how simple it is to harness the power of mod_perl.
On a decent machine, it should take half an hour or less to compile
and configure a mod_perl-based Apache server and get it running.
Although there are binary distributions of mod_perl-enabled Apache
servers available for various platforms, we recommend that you always
build mod_perl from source. It's simple to do
(provided you have all the proper tools on your machine), and
building from source circumvents possible problems with binary
distributions, such as those reported for the RPM packages built for
Red Hat Linux.
The mod_perl installation that follows has been tested on many
mainstream Unix and Linux platforms. Unless you're
using a very nonstandard system, you should have no problems when
building the basic mod_perl server.
Before we continue, however, we have one important bit of advice:
while you're learning mod_perl, be sure that you
experiment on a private machine and not on a production server.
The two packages are named apache_1.3.xx.tar.gz
and mod_perl-1.xx.tar.gz, where
1.3.xx and 1.xx should be
replaced with the real version numbers of Apache and mod_perl,
respectively. Although 2.0 development versions of Apache and
mod_perl are available, this book covers the mod_perl 1.0 and Apache
1.3 generation, which were the stable versions when this book was
written. See Chapter 24 and Chapter 25 for more information on the Apache 2.0 and
mod_perl 2.0 generation.
Move the downloaded packages into a directory of your choice (for
example, /home/stas/src/), proceed with the
following steps, and mod_perl will be installed:
panic% cd /home/stas/src
panic% tar -zvxf apache_1.3.xx.tar.gz
panic% tar -zvxf mod_perl-1.xx.tar.gz
panic% cd mod_perl-1.xx
panic% perl Makefile.PL APACHE_SRC=../apache_1.3.xx/src \
APACHE_PREFIX=/home/httpd DO_HTTPD=1 USE_APACI=1 EVERYTHING=1
panic% make && make test
panic% su
panic# make install
All that remains is to add a few configuration lines to the Apache
configuration file
(/usr/local/apache/conf/httpd.conf), start the
server, and enjoy mod_perl.