Link to home
Start Free TrialLog in
Avatar of jhill03
jhill03

asked on

mod_perl2 loaded on startup but not loaded when running CGI scripts

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.

httpd.conf
--------------------------
#
# 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>

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

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;

1;
--------------------------------------------------

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
ASKER CERTIFIED SOLUTION
Avatar of msklizmantas
msklizmantas
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jhill03
jhill03

ASKER

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.

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