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.
First download the latest stable sources of Apache 2.0, mod_perl 2.0, and Perl 5.8.0.[59] 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:
[59]Perl 5.6.1 can be used with prefork, but if you build from source why not go for the best?
mod_perl 2.0—http://perl.apache.org/dist/
Apache 2.0—http://httpd.apache.org/dist/
Perl 5.8.0—http://cpan.org/src/
You can always find the most up-to-date download information at http://perl.apache.org/download/.
Next, build Apache 2.0:
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.
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
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):
Extract the source:
panic% tar -xzvf perl-5.8.0.tar.gz
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.
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 CPAN.pm 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:
Extract the source:
panic% tar -xzvf mod_perl-2.0.x.tar.gz
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 http://perl.apache.org/docs/2.0/user/. Configure:
panic% cd mod_perl-2.0.x panic% perl Makefile.PL MP_AP_PREFIX=/home/stas/httpd/prefork \ MP_INST_APACHE2=1
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:
MP_AP_PREFIX=\Apache2
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.
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
Apache 2.0 binaries can be obtained from http://httpd.apache.org/dist/binaries/.
Perl 5.6.1 or 5.8.0 binaries can be obtained from http://cpan.org/ports/index.html.
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:
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 http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl-2.ppd
Another way, which will be useful if you plan on installing additional Apache modules, is to set the repository within the PPMshell utility as follows (the lines are broken here for readability):
PPM> set repository theoryx5 http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer
or, for PPM3:
PPM> rep add theoryx5 http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer
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 mod_perl.so; 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 http://theoryx5.uwinnipeg.ca/ppmpackages/x86/. This file, when unpacked, contains mod_perl.so 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.
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.
Copyright © 2003 O'Reilly & Associates. All rights reserved.