Getting Started with mod_perl in 30 Minutes

By Stas Bekman (Send Email)
Posted Jun 23, 2000


Intimidated by the prospects of configuring mod_perl on your Apache server? Don't be. 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 column, Stas Bekman explains how to get mod_perl up and running with a minimum of fuss.



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.

Installing mod_perl in 10 Minutes and 10 Command Lines

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/apache_1.3.12.tar.gz
  % lwp-download http://perl.apache.org/dist/mod_perl-1.24.tar.gz
  % tar -zvxf apache_1.3.12.tar.gz
  % tar -zvxf mod_perl-1.24.tar.gz
  % cd mod_perl-1.24
  % perl Makefile.PL APACHE_SRC=../apache_1.3.12/src     DO_HTTPD=1 USE_APACI=1 PERL_MARK_WHERE=1 EVERYTHING=1
  % make && make test && make install
  % cd ../apache_1.3.12
  % 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.

Installing mod_perl in 10 Minutes and 10 Paragraphs

Just as advertised in the previous section--the building time stays the same: 10 minutes, but if one of the steps didn't work for you or you didn't have the courage to try it, I will explain each step in fine details here. If everything was just fine you can skip this section and move on to the next one.

First you have to become a root user in order to install the files in a protected area. If you don't have root access, you can install all the files under your home directory as well. We will talk about the nuances of this approach in a future article. I'll also assume that you have perl and cc or an equivalent C compiler installed.

I assume that all builds are being done in the /usr/src directory. So we go into this directory:

  % cd /usr/src

Page 1 of 8

Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.


