Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 11.1 Design of mod_perlChapter 11
Web Server Programming with mod_perl
Next: 11.3 mod_perl Handlers
 

11.2 Installing mod_perl

If you already have Apache installed on your machine, you will have to rebuild it with mod_perl. You can get the source for both Apache and mod_perl from http://www.apache.org/. (You can also get mod_perl from CPAN.) If there isn't already an Apache httpd in the Apache source tree, you must build one. Then build mod_perl as directed in the INSTALL file for the mod_perl distribution.

As we've mentioned, mod_perl allows you to hook in Perl modules as handlers for various stages of a request. By default, however, the only callback hook that is enabled is PerlHandler, which is the one used to process content (i.e., a CGI document). If you want to use other hooks, for example to extend Apache's logging facilities via the PerlLogHandler directive, you'll need to specify it at build time as directed in the INSTALL file. For example:

% perl Makefile.PL PERL_LOG=1
The mod_perl Makefile replaces the httpd in the Apache source tree with a Perl-enabled one. When you install mod_perl, it not only installs the new httpd into your system area, it also installs several Perl modules including Apache::Registry.

At the time of this writing, both Apache and mod_perl are being ported to Win32. However, mod_perl will only run with the standard Perl Win32 port (not ActiveState's). The INSTALL.win32 file contains the instructions for installing mod_perl under Win32.


Previous: 11.1 Design of mod_perlPerl in a NutshellNext: 11.3 mod_perl Handlers
11.1 Design of mod_perlBook Index11.3 mod_perl Handlers