Web Site Design


Chapter 1 - Installing mod_perl and Configuring Your Server


This chapter explains how to set up mod_perl to run in an Apache2 environment.

First, check to see if you already have mod_perl installed:

$ sudo dpkg --get-selections | grep libapache
libapache2-mod-perl2 install
libapache2-mod-php5 install
libapache2-reload-perl install

If you see something like this, congratulations! Skip to: mod_perl Server Configuration

Before You Begin - Prerequisites

Apache2 - Verify that you have a recent version of Apache2 installed. If not, install it.

$ sudo apache2 -v

Perl - Verify that you have Perl version 5.6.1 or greater. If not, install or update it.

$ perl -v

threads - verify that you are not using 5005threads

$ perl -V:use5005threads
use5005threads='undef';

If instead it comes back with

$ perl -V:use5005threads
use5005threads='define';

then you must rebuild Perl without threads enabled or with -Dusethreads. If you are using a threaded MPM, it should report

perl -V:useithreads -V:usemultiplicity
useithreads='define';
usemultiplicity='define';

If it doesn't, you need to rebuild Perl with -Dusethreads. If you want to use threads.pm, you mus use Perl 5.8.1 or higher with ithreads enabled. Other Dependencies: If you use CGI.pm or Compress::Zlib in your mod_perl code you need at least the following versions: CGI.pm 3.11 Compress::Zlib 1.09 One way to ensure you have all the mod_perl dependencies to install Bundle::Apache2 from CPAN. CGI.pm

Installing Apache2 mod_perl

You can install mod_perl from a pre-built package or from source.
To install from a distribution package, use your usual methods for installing.
For Debian squeeze:

sudo apt-get update
sudo apt-get upgrade --show-upgraded
sudo apt-get install libapache2-mod-perl2

To install from source, check out: Installing mod_perl from source

mod_perl Server Configuration

This is distribution and installation specific, so I'll given some general information. For Debian squeeze:
Go to you apache2 sites-available directory, and add this - either to default, or to a specific site:
<Location /cgi-bin>
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
  PerlOptions +ParseHeaders
  Options +ExecCGI
  Order allow,deny
  Allow from all
</Location>

Then reload your Apache server (this is OS and distribution-specific):

sudo /etc/init.d/apache2 reload


Web Site Design Perl Pages

StarDevSoft Home