We help IT Professionals succeed at work.

mod_perl2 loaded on startup but not loaded when running CGI scripts

jhill03 asked
Last Modified: 2012-05-05
Running into an issue when trying to get mod_perl applied to the scripts in my /var/www/cgi-bin directory.
Apache is up and running with no errors, it just doesn't appear that mod_perl is being utilized for the scripts in my cgi-bin directory, even though it (mod_perl2) is loaded on startup. I verified that by 'warning' the value of $ENV{MOD_PERL} to the error_log via startup.pl. That value is $ENV{MOD_PERL}: mod_perl/2.0.3 at /etc/httpd/conf/startup.pl line 3.

So given that, I've probably got a bad/incomplete setting for mod_perl to be utilized for my scripts. I just can't seem to find it and not sure where to look... getting pointed in the right direction would be a great assistence...

Here's some entries in the various .conf file... Note: I haven't included the entire .conf file(s), but I'm hoping I've provided enough that either someone can spot the error or can say "You also need..." -- Thanks.

# Load config files from the config directory "/etc/httpd/conf.d".
Include conf.d/*.conf
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot "/var/www/html"
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
ScriptAlias /cgi/ "/var/www/cgi-bin/"

in perl.conf
# This will allow execution of mod_perl to compile your scripts to
# subroutines which it will execute directly, avoiding the costly
# compile process for most requests.

PerlRequire /etc/httpd/conf/startup.pl

PerlModule ModPerl::PerlRun
PerlModule ModPerl::Registry

<Directory cgi-bin>
  AddHandler perl-script .cgi
  PerlResponseHandler ModPerl::PerlRun
  PerlOptions +ParseHeaders
  Options ExecCGI
  allow from all

<Directory htdocs>
  AddHandler perl-script .cgi
  PerlResponseHandler ModPerl::PerlRun
  PerlOptions +ParseHeaders
  Options ExecCGI
  allow from all

and startup.pl
use strict;

warn "\$ENV{MOD_PERL}: $ENV{MOD_PERL}"; # verify that mod perl is being loaded

# preload and initialize CGI.pm
use CGI();
CGI->compile(qw(cookie param header redirect));

# preload DBI
use Apache::DBI;
use DBD::mysql;

# preload MD5;
#use MD5;

$Apache::DBI::DEBUG = 2;


Apache: 2.0.54
mod_perl: 2.0.3
perl: 5.8.6
O/S: Linux my.host.name 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686 athlon i386 GNU/Linux
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)


Yep. I figured all that out late last night, but that's exactly what the problem was.

I couldn't have stated it quite so clearly as you though... I just figured out it was the ScriptAlias directive that was causing the issue.

no problem ;) my clear explanation comes from the docs ;)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.