The mod_perl module was installed on a web server created from Apache2 on a SuSE 9.2 platform.However persuading this to actually work took some fiddliing around.It was necessary to alter one of the main Apache configuration files and also the virtual hosts configuration.
Step 1:Use YaST to install the mod_perl Apache2 module and, if it isn't already installed, to also install the perl suite itself.
Step 2:Use YaST to alter the APACHE_MODULES parameter.The steps are:
Select the /etc/sysconfig editor
Choose to edit “Network/WWW/Apache2”
Choose to edit parameter “APACHE_MODULES”
Add the token “perl” to the end of the list of modules.
Step 3:Edit the Apache configuration to disable CGI except where explicitly allowed (this step might not be necessary or appropriate for all servers)
<directory "/"> allow from none Options -ExecCGI </directory>
Step 4: Edit the virtual hosts definition.
<directory "/srv/www/...path to directory holding perl scripts..."> Options +ExecCGI SetHandler perl-script PerlHandler ModPerl::Registry PerlSendHeader On </directory>
Make sure you put the correct path name for your server!
Step 5:Put the perl scripts in the directory.Make sure they have the necessary ownership and permissions.
Step 6: Make sure all the scripts start with the following lines:
#!/usr/bin/perl use strict;
The first line identifies the perl executable program should you ever wish to run the script from the command line.The second line tells the perl interpreter to be strict about what is allowed and disallowed. This is an appropriate security precaution for scripts running on a web server and will, amongst other things, force the script developer to explicitly define all variables.