Creating The Script Directory

By far the most commonly used part of mod_perl is the Apache::Registry module.  This module creates a simulated CGI environment that your exiting CGI scripts can use without having to be rewritten.  The first step to setting up Apache::Registry is creating a directory for CGI scripts that use it.  By convention this is a subdirectory named perl of the Apache directory, but you may set up multiple directories with different names in different locations.  Become root using su or sudo, and create the perl directory for Apache::Registry to use.
 

 
lamonml@hespera> cd /usr/local/apache
lamonml@hespera> sudo mkdir perl

Aliasing The Script Directory In httpd.conf

Once you have created a directory for Apache::Registry to use, you must tell the Apache server about the directory.  To do this, become root using su or sudo and place the directory information at the end of the httpd.conf file.  Edit httpd.conf using your favorite text editor:
 

 
lamonml@hespera> cd /usr/local/apache/conf
lamonml@hespera> sudo vi httpd.conf

Move to the bottom of the configuration file (use Shift-G in vi), and add the following text.
 

 
Alias /perl/ /usr/local/apache/perl
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options +ExecCGI
</Location>

Restarting The Server

Now that mod_perl and Apache::Registry have been fully configured, you must restart the Apache server to take advantage of them.  The easiest way to do this is to become root and use the apachectl utility.
 

 
lamonml@hespera> cd /usr/local/apache/bin
lamonml@hespera> sudo ./apachectl restart

If all goes well, the server will restart cleanly and you will now have a mod_perl enabled version of Apache running on your system.