To run mod_perl, you'll need to uncomment two lines in your
httpd.conf file.
After the main LoadModule section, there's a
list of three additional modules. Uncomment the
perl_module line so that instead of:
#LoadModule perl_module modules/libperl.so
|
It reads:
LoadModule perl_module modules/libperl.so
|
After the main AddModule section, there's another
list of three additional modules. Uncomment the
mod_perl.c line so that instead of:
It reads:
After you've uncommented these two lines, save the
httpd.conf file and then restart your server as
described in the section called Starting and Stopping Your Server in Chapter 3. You should
now be running mod_perl.
Mod_perl module is large and fairly complicated. It would be impossible
to include all it can do in this guide. Since the most commonly used
role of mod_perl is as a replacement for CGI, that capability is already
set up for you in the Apache configuration
file, httpd.conf. The mod_perl configuration
directives are surrounded by <IfModule> tags,
indicating that the directives are processed if
mod_perl.c was compiled in to the
Apache server. By default, the module was
compiled in, so mod_perl should be ready to go. The pertinent lines in
httpd.conf are as follows:
<IfModule mod_perl.c>
Alias /perl/ /home/httpd/perl/
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
</IfModule>
|
The directory where you store your Perl scripts should be
/home/httpd/perl/. The
/home/httpd/perl/ directory will be like a
cgi-bin directory. The directory where browsers
will access scripts on your server with URLs that start with
http://your_domain/perl/ is
/perl.
For more information on using mod_perl as a CGI replacement refer to the
cgi_to_mod_perl Perl documentation by running the command:
For more information on mod_perl's configuration and capabilities,
please refer to the Apache/Perl Integration
Project Web pages at http://perl.apache.org/.