NAME

Installing mod_perl

Description

FIXME: DESCRIPTION

Prerequisites

Lots of prerequisites

Installing from Source

Download the httpd-2.0 and modperl-2.0 tarballs, and extract them in the same directory.

Or use anoncvs (password is "anoncvs"):

% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co modperl-2.0
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co httpd-2.0
% cd httpd-2.0/srclib
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co apr
% cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co apr-util
% cd ..
% ./buildconf
% ./configure --prefix=$HOME/apache-2.0 --with-mpm=prefork
% make && make install

Once extracted, whenever you want to sync with the latest httpd-2.0 version and rebuild, run:

% cd httpd-2.0
% cvs up -dP
% make distclean && ./buildconf
% ./configure --prefix=$HOME/apache-2.0 --with-mpm=prefork
% make && make install

For bleeding edge Perl:

# (--delete to ensure a clean state)
% rsync -acvz --delete --force \
  rsync://ftp.linux.activestate.com/perl-current/ perl-current
% cd perl-current
% ./Configure -des -Dprefix=$HOME/bleedperl \
  -Dusethreads -Doptimize='-g' -Dusedevel
% make && make test && make install
% ln -s $HOME/bleedperl/bin/perl5.x.x $HOME/bleedperl/bin/perl

or otherwise make sure that your perl was built with threads enabled if you want to use a threaded MPM.

If you are re-building Perl after rsync-ing, make sure to cleanup:

% make distclean

before running ./Configure.

You'll also want to install (at least) LWP into the bleedperl/lib directory if you want to fully test mod_perl, because normally a privately installed bleedperl won't find libraries installed in the normal places; it only looks in it's own lib tree. You can install LWP with CPAN.pm shell:

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

Compiling

Create the build environment

% cd modperl-2.0
% perl Makefile.PL MP_APXS=$apache_prefix/bin/apxs && make

options an optional list of (key,value) pairs.

Boolean options: set them with MP_XXX=1.

MP_PROMPT_DEFAULT

Accept default values for all would-be prompts

MP_GENERATE_XS

Generate xs code from parsed source headers in xs/tables/$httpd_version. Default is 1, set to 0 to disable.

MP_USE_DSO

Build mod_perl as a DSO (default)

MP_APXS

Path to apxs

MP_AP_PREFIX

Apache installation prefix (can be used to derive apxs values on platforms where apxs is not supported)

MP_USE_STATIC

Build mod_perl static

MP_STATIC_EXTS

Build Apache::*.xs as static extensions

MP_USE_GTOP

Link with libgtop and enable libgtop reporting

MP_DEBUG

Turn on debugging (-g -lperld) and tracing

MP_MAINTAINER

NOTE: apache must be build with --enable-maintainer-mode

Maintainer compile mode, turn on MP_DEBUG and add gcc flags:

-DAP_DEBUG \
-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
MP_TRACE

Enable tracing

MP_INST_APACHE2

Install *.pm relative to Apache2/ directory

Non-Boolean options: set them with MP_XXX=value.

MP_CCOPTS

Add to compiler flags, e.g.

MP_CCOPTS=-Werror

(Notice that -Werror will work only with the Perl version 5.007 and higher.)

MP_OPTIONS_FILE

Read options from given file

mod_perl specific compiler options:

-DMP_IOBUFSIZE

Change the default mod_perl's 8K IO buffer size, e.g. 16K:

MP_CCOPTS=-DMP_IOBUFSIZE=16384

Options can also be specified in the file makepl_args.mod_perl2 or .makepl_args.mod_perl2. The file can be placed under $ENV{HOME}, the root of the source package or its parent directory. So if you unpack the mod_perl source into /tmp/mod_perl-2.x/ and your home is /home/foo/, the file will be searched in:

/tmp/mod_perl-2.x/makepl_args.mod_perl2
/tmp/makepl_args.mod_perl2
/home/foo/makepl_args.mod_perl2
/tmp/mod_perl-2.x/.makepl_args.mod_perl2
/tmp/.makepl_args.mod_perl2
/home/foo/.makepl_args.mod_perl2

If the file specified in MP_OPTIONS_FILE is found the makepl_args.mod_perl2 will be ignored.

Command line options override those from makepl_args.mod_perl2 and those from MP_OPTIONS_FILE.

Compile mod_perl

% make

Configure and compile Apache

% cd ../httpd-2.0
% ./configure --with-mpm=prefork
% make

Test mod_perl

% make test

Apache::Test Framework document covers the make test suite.

META: probably need to link directly to the 'Running Tests' section.

Howto generate source tables

All mod_perl-2.0 xs code is generated from parsed header files. While in pre-release mode, a version of these tables will be checked in to xs/tables/current. Should you wish to update these tables, here's how:

NOTE: requires C::Scan 0.75, which at the moment is unreleased, there is a working copy here: http://perl.apache.org/~dougm/Scan.pm

NOTE: source_scan.pl is a HEAVY process, do not be alarmed.

% perl build/source_scan.pl apxs $apache_prefix/bin/apxs

META: this is covered in Core Explained should probably move/point there.

Re-using Build Options

Since mod_perl remembers what build options were used to build it, you can use this knowledge to rebuild it using the same options. Simply chdir to the mod_perl source directory and run:

% cd modperl-2.0
% perl -MApache::Build -e rebuild

Installing from Binary Packages

Maintainers

Maintainer is the person(s) you should contact with updates, corrections and patches.

  • Doug MacEachern <dougm (at) covalent.net>

Authors

  • Doug MacEachern <dougm (at) covalent.net>

Only the major authors are listed above. For contributors see the Changes file.