[oclug] RedHat, Apache and Mod Perl
Burns MacDonald
burns at burnsmacdonald.com
Sun Jul 13 19:48:12 EDT 2003
OK.... here is the deal.. A friend is trying to get mod_perl going on a
RedHat server. Apache 2.0.47 from RPMs at RedHat. mod_perl from same.
Here is the failure mode:
Server error!
The server encountered an internal error and was unable to complete your
request.
Error message:
Can't locate object method "request" via package "Apache" at
/usr/lib/perl5/5.8.0/CGI.pm line 269.
If you think this is a server error, please contact the webmaster
Error 500
localhost
Thu 10 Jul 2003 11:59:16 AM EDT
Apache/2.0.40 (Red Hat Linux)
here is the script:
[root at purple wfenwick]# cd /var/www/perl[root at purple perl]# more
test2#!/usr/bin/perl
use CGI qw(:standard);#use CGI;
my $query = new CGI;
print $query->header;
print "<html>\n";print "<head><title>CGI Results</title></head>\n";print
"<body bgcolor=\"#FFFFFF\">\n";
if ($query->param("search")) { $search = $query->param("search");
open(DATA,"DATA.TXT") || print "Open Error: $!\n"; while
(<DATA>) { if (/${search}/i) {
$customers++; } } print "We have $customers
customers "; print "whose names contain
n"; } else { print "<form method=GET
action=",$ENV{"SCRIPT_NAME"},">\n"; print "<input name=search size=10
value=\"r\">\n"; print "<input type=submit>\n"; print
"</form>\n";}
print "</body></html>\n";
here is the config for mod_perl:
[root at purple perl]# cd /etc/httpd/conf.d[root at purple conf.d]# lsperl.conf
README ssl.conf ssl.orig[root at purple conf.d]# more perl.conf## Mod_perl
incorporates a Perl interpreter into the Apache web server,# so that the
Apache web server can directly execute Perl code.# Mod_perl links the Perl
runtime library into the Apache web server# and provides an object-oriented
Perl interface for Apache's C# language API. The end result is a quicker
CGI script turnaround# process, since no external Perl interpreter has to be
started.#
LoadModule perl_module modules/mod_perl.so
# 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.#Alias /perl /var/www/perl<Directory
/var/www/perl> SetHandler perl-script PerlHandler
ModPerl::Registry::handler PerlOptions +ParseHeaders Options
+ExecCGI</Directory>
I tried upgrading the CGI.pm and associated files to the latest, but with no
better result. Also a simpler script seems to work just fine...
[root at purple perl]# more test.pl#!/usr/bin/perlprint "Content-type:
text/plain\n\n";print "mod_perl rules!\n";
Any ideas or pointers...?
More information about the OCLUG
mailing list