Search:  
Gentoo Wiki

Apache_Modules_mod_perl

Apache2 Series


Main


Modules


Addons & Tunnels


Tips


Configuring


Other

edit

Getting Started

First install Apache2.

To get started with apache2/perl, you'll need mod_perl.

emerge -av mod_perl


Configuring

Gentoo Default Config

The next step is to use the gentoo method of enabling the loading of mod_perl. If you look in /etc/apache2/modules.d/, you'll see the file for mod_perl, and the file begins with "<IfDefine PERL>". To enable this in gentoo, you'll need to edit the file /etc/conf.d/apache2 and find the line similar to what I list just below. I use multiple extra modules, and your line might not be exactly like mine.

File: /etc/conf.d/apache2
APACHE2_OPTS="-D SSL -D PHP4 -D PERL"

*.pl and *.cgi auto Parse

This is the last part. I should note that I use perl heavily on my server, and don't like having to house perl scripts in a directory like /cgi-perl/. I therefore changed the default Gentoo config a little to catch any file which looks like "*.pl" and treat it as a perl script.

This takes two steps:

Step 1: comment out the line:

File: /etc/apache2/modules.d/75_mod_perl.conf
 # Alias /cgi-perl/ /var/www/localhost/perl/
  • Note that the '#' comments out the line. My config file has it on line 16, yours won't be on the same line, but is likely to be close.

Step 2: change a code block:

File: /etc/apache2/modules.d/75_mod_perl.conf

It was a block that looked like:

 <Location /cgi-perl/*.pl>
   .
   .
   .
 </Location>

I changed it to:

 <Files ~ "\.(pl|cgi)$">
   SetHandler perl-script
   PerlResponseHandler ModPerl::PerlRun
   Options +ExecCGI
   PerlSendHeader On
 </Files>

Note that using the ModPerl::PerlRun response handler will not give you all the advantages mod_perl has over perl/CGI. For more information, consult the freely available ebook Practical mod_perl.

Testing

/etc/init.d/apache2 restart

Hope this gets you rollin' with apache2/perl. It worked for me!

If you receive as an error notice

The server encountered an internal error ...
More information about this error may be available in the server error log.

you can

cat /usr/lib/apache2/logs/error_log

Common Problems

Note: If you receive an error about /usr/lib/apache2/modules/mod_perl.so: undefined symbol: Perl_Ipatchlevel_ptr or /usr/lib/apache2/modules/mod_perl.so: undefined symbol: Perl_Top_ptr, it's probably because you just added ithreads to your make.conf file. Re-emerge libperl.

Retrieved from "http://www.gentoo-wiki.info/Apache_Modules_mod_perl"

Last modified: Sat, 19 Apr 2008 11:15:00 +0000 Hits: 40,814