JavaScript EditorFree JavaScript Editor     Free JavaScript Scripts 

Main Page Previous Section Next Section

24.4 Installing mod_perl 2.0

Since as of this writing mod_perl 2.0 hasn't yet been released, the installation instructions may change a bit, but the basics should be the same. Always refer to the mod_perl documentation for the correct information.

24.4.1 Installing from Source

First download the latest stable sources of Apache 2.0, mod_perl 2.0, and Perl 5.8.0.[2] Remember that mod_perl 1.0 works only with Apache 1.3, and mod_perl 2.0 requires Apache 2.0. You can get the sources from:

[2] Perl 5.6.1 can be used with prefork, but if you build from source why not go for the best?

You can always find the most up-to-date download information at

Next, build Apache 2.0:

  1. Extract the source (as usual, replace x with the correct version number):

    panic% tar -xzvf httpd-2.0.xx

    If you don't have GNU tar(1), use the appropriate tools and flags to extract the source.

  2. Configure:

    panic% cd httpd-2.0.xx
    panic% ./configure --prefix=/home/httpd/httpd-2.0 --with-mpm=prefork

    Adjust the —prefix option to the directory where you want Apache 2.0 to be installed. If you want to use a different MPM, adjust the —with-mpm option. The easiest way to find all of the configuration options for Apache 2.0 is to run:

    panic% ./configure --help
  3. Finally, build and install:

    panic% make && make install

If you don't have Perl 5.6.0 or higher installed, or you need to rebuild it because you want to enable certain compile-time features or you want to run one of the threaded MPMs, which require Perl 5.8.0, build Perl (we will assume that you build Perl 5.8.0):

  1. Extract the source:

    panic% tar -xzvf perl-5.8.0.tar.gz
  2. Configure:

    panic% cd perl-5.8.0
    panic% ./Configure -des -Dprefix=$HOME/perl/perl-5.8.0 -Dusethreads

    This configuration accepts all the defaults suggested by the Configure script and produces a terse output. The -Dusethreads option enables Perl ithreads. The -Dprefix option specifies a custom installation directory, which you may want to adjust. For example, you may decide to install it in the default location provided by Perl, which is /usr/local under most systems.

    For a complete list of configuration options and for information on installation on non-Unix systems, refer to the INSTALL document.

  3. Now build, test, and install Perl:

    panic% make && make test && make install

Before proceeding with the installation of mod_perl 2.0, it's advisable to install at least the LWP package into your newly installed Perl distribution so that you can fully test mod_perl 2.0 later. You can use to accomplish that:

panic% $HOME/perl/perl-5.8.0/bin/perl -MCPAN -e 'install("LWP")'

Now that you have Perl 5.8.0 and Apache 2.0 installed, you can proceed with the mod_perl 2.0 installation:

  1. Extract the source:

    panic% tar -xzvf mod_perl-2.0.x.tar.gz
  2. Remember the nightmare number of options for mod_perl 1.0? You need only two options to build mod_perl 2.0. If you need more control, read install.pod in the source mod_perl distribution or online at Configure:

    panic% cd mod_perl-2.0.x
    panic% perl Makefile.PL MP_AP_PREFIX=/home/stas/httpd/prefork \

    The MP_AP_PREFIX option specifies the base directory of the installed Apache 2.0, under which the include/ directory with Apache C header files can be found. For example, if you have installed Apache 2.0 in the directory \Apache2 on Win32, you should use:


    The MP_INST_APACHE2 option is needed only if you have mod_perl 1.0 installed under the same Perl tree. You can remove this option if you don't have or don't plan to install mod_perl 1.0.

  3. Now build, test, and install mod_perl 2.0:

    panic% make && make test && make install

    On Win32 you have to use nmake instead of make, and the && chaining doesn't work on all Win32 platforms, so instead you should do:

    C:\modperl-2.0\> nmake
    C:\modperl-2.0\> nmake test
    C:\modperl-2.0\> nmake install

24.4.2 Installing Binaries

Apache 2.0 binaries can be obtained from

Perl 5.6.1 or 5.8.0 binaries can be obtained from

For mod_perl 2.0, as of this writing only the binaries for the Win32 platform are available, kindly prepared and maintained by Randy Kobes. Once mod_perl 2.0 is released, various OS distributions will provide binary versions for their platforms.

If you are not on a Win32 platform you can safely skip to the next section.

There are two ways of obtaining a binary mod_perl 2.0 package for Win32:


The first, for ActivePerl users, is through PPM, which assumes you already have ActivePerl (build 6xx or later), available from, and a Win32 Apache 2.0 binary, available from In installing this, you may find it convenient when transcribing any Unix-oriented documentation to choose installation directories that do not have spaces in their names (e.g., C:\Apache2).

After installing Perl and Apache 2.0, you can then install mod_perl 2.0 via the PPM utility. ActiveState does not maintain mod_perl in its PPM repository, so you must get it from somewhere else. One way is simply to do:

C:\> ppm install

Another way, which will be useful if you plan on installing additional Apache modules, is to set the repository within the PPM shell utility as follows (the lines are broken here for readability):

PPM> set repository theoryx5

or, for PPM3:

PPM> rep add theoryx5

mod_perl 2.0 can then be installed as:

PPM> install mod_perl-2

This will install the necessary modules under an Apache2/ subdirectory in your Perl tree, so as not to disturb an existing Apache/ directory from mod_perl 1.0. See the next section for instructions on how to add this directory to the @INC path for searching for modules.

The mod_perl PPM package also includes the necessary Apache DLL; a post-installation script that will offer to copy this file to your Apache2 modules directory (e.g., C:\Apache2\modules) should be run. If this is not done, you can get the file mod_perl-2.tar.gz from This file, when unpacked, contains in the top-level directory.

Note that the mod_perl package available from this site will always use the latest mod_perl sources compiled against the latest official Apache release; depending on changes made in Apache, you may or may not be able to use an earlier Apache binary. However, in the Apache Win32 world it is a particularly good idea to use the latest version, for bug and security fixes.

Apache/mod_perl binary

At you can find an archive called Apache2.tar.gz containing a binary version of Apache 2.0 with mod_perl 2.0. This archive unpacks into an Apache2 directory, underneath which is a blib subdirectory containing the necessary mod_perl files (enabled with a PerlSwitches directive in httpd.conf). Some editing of httpd.conf will be necessary to reflect the location of the installed directory. See the Apache2.readme file for further information.

This package, which is updated periodically, is compiled against recent CVS sources of Apache 2.0 and mod_perl 2.0. As such, it may contain features, and bugs, not present in the current official releases. Also for this reason, these may not be binary-compatible with other versions of Apache 2.0/mod_perl 2.0.

Apache/mod_perl/Perl 5.8 binary distribution

Because mod_perl 2.0 works best with Perl 5.8 in threaded environments such as Apache 2.0 with the win32 MPM, there is a package including Perl 5.8, Apache 2.0, and mod_perl 2.0. To get this, look for the perl-5.8-win32-bin.tar.gz package at, and extract it to C:\, which will give you an Apache2 directory containing the Apache 2.0 installation along with mod_perl 2.0, and a Perl directory containing the Perl installation (you should add this Perl directory to your path).

    Main Page Previous Section Next Section

    JavaScript EditorJavaScript Validator     Web Manuals and Tutorials