Question
I have this problem with enabling mod_perl for TWiki (Feb/2003) on a Red Hat Linux 8.0 server that's driving me crazy #-(
Since last Friday I'm trying to do this having tried lots of different configurations, but very unsuccessfully, so far... Without mod_perl everything works fine, but somewhat slowly. When I enable mod_perl for the
twiki/bin directory (or just some of the scripts like view, testenv, etc.) I get errors in the browser complaining about missing Perl modules/files in the
@INC path.
Namely, when I run testenv I get the following output:
Perl Module(s) missing
Warning: Essential module CGI not installed - please check your Perl installation,
including the setting of @INC, and re-install Perl if necessary.
@INC setting:
../lib
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
When I run the any other script from
twiki/bin (view or something) I get a more specific error telling me that there is something wrong with setlib.cfg (which comes in the
twiki/bin directory). The
@INC path includes '.' which I am led to believe is not
/var/www/twiki/bin, but the current directory of Apache, mod_perl or something like that...
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Can't locate setlib.cfg in @INC (@INC contains: . . /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl)
at /var/www/twiki/bin/view line 25. *BEGIN failed--compilation aborted
at /var/www/twiki/bin/view line 25*.
If you think this is a server error, please contact the webmaster
*Error 500*
So, as a workaround I create a symlink in
/usr/lib/perl5/site_perl/5.8.0 (for instance) to
/var/www/twiki/bin/setlib.cfg and try it... In this case, the server complains about not being able to find
TWiki.pm!!
I edit
setlib.cfg and set the
$twikiLibPath to
/var/www/twiki/lib... and try again. This time it complains with the same Error 500 saying:
"Can't locate object method "request" via package "Apache" at /usr/lib/perl5/5.8.0/CGI.pm line 269". Now I think this might be some problem with the Apache/Perl/mod_perl RPMs included in the stock Red Hat 8.0 distro!
I'm really confused about all these errors, and my currently rudimentary knowledge about perl modules and mod_perl does not allow me to see further. It would be great if someone could point me to a possible solution without having to resintall lots of software (I saw a working example on RH 8.0 by Matthew Mastracci @
ModPerl).
Else I will try to recompile mod_perl from source (as I heard there are some issues with some RPMs) and maybe Apache 2. If it fails I will start considering to degrade to launch a separate instance of Apache 1.3.x (yes, i know that v2.0 is still not recommended for TWiki but we have lots of other stuff currently configured in this server).
Below is the relevant extract from my current httpd.conf file.
<Directory "/var/www/twiki/bin">
SetHandler cgi-script
Options ExecCGI
Allow from all
<FilesMatch "^(view|viewfile|edit|preview|save|attach|upload|register|passwd|manage)">
SetHandler perl-script
PerlHandler ModPerl::Registry::handler
PerlSendHeader On
Options ExecCGI
</FilesMatch>
</Directory>
Thanks in advance...
- TWiki version: 01 Feb 2003
- Perl version: 5.8.0
- Web server & version: 2.0.40 (mod_perl 1.99_05)
- Server OS: Red Hat Linux 8.0
- Web browser & version: (Any)
- Client OS: (Any)
--
DimaDiall - 17 Mar 2003
Coincidentally, I just got stuck by the same problem. My system is a fresh installation, just configured TWiki this week:
- TWiki version: 01 Feb 2003
- Perl version: 5.6.1
- Web server & version: HPApache 2.0.39 (mod_perl 1.99_03)
- Server OS: HP-UX 11.00 64bit
- Web browser & version: (Any)
- Client OS: (Any)
--
IngoKarkat - 20 Mar 2003
Answer
See the
ModPerl pages - this has been discussed before, see also
Google:setlib+mod_perl+twiki
. Basically, you need an absolute path in the
@INC
that is set in one of the Apache config files (
SetEnv directive should work) to enable it to find CGI.pm and setlib.cfg - then you can use setlib.cfg to find the TWiki lib directory via another absolute path. I haven't done this myself but it should work. See also
TWikiOn for hints on your respective platforms.
--
RichardDonkin - 20 Mar 2003
I tried this by setting up the mod_perl's
@INC array the
/etc/httpd/conf.d/perl.conf (included by
httpd.conf) as described in the docs (
http://perl.apache.org/docs/1.0/guide/config.html#The_Startup_File
).
This prepended the
/var/www/twiki/bin path to the
@INC array, so now it can find the setlib.cfg file. Basically, this has the same result as symlinking this file in some directory that was already in the
@INC path (as I described in my original post)...
From this point I had the same problems that lead me to post this issue. So, first it cannot find the Apache.pm module:
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Can't locate Apache.pm in @INC (@INC contains: /var/www/twiki/lib . /var/www/twiki/bin /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at /usr/lib/perl5/5.8.0/CGI.pm line 161. Compilation failed in require at /var/www/twiki/bin/view line 28. BEGIN failed--compilation aborted at /var/www/twiki/bin/view line 28.
If you think this is a server error, please contact the webmaster
Error 500
In response, I create a symlink named
Apache.pm pointing to
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache2.pm. Then I receive this error:
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
So, I am lead to believe that the stock Red Hat 8.0 distro has a crapy integration of mod_perl and Apache2. I've read already something about it, but I'm not 100% sure...
Can anyone point towards the simplest way to get around this, like upgrading to the latest RPMs (Apache2 and mod_perl? Perl too?) or something. I'd like to avoid getting "dirty" sorting out all of the dependencies, compiling and installing everything by hand, but probably I'll be better off just grabbing the sources for and building it myself.
--
DimaDiall - 26 Mar 2003
Fortunately, I got mod_perl to run, but only
without TaintChecking. While trying to enable
TaintChecking, I stumbled across a behavior that may be related to
DimaDialls problem:
ModPerl requires additional include directories (located at my system inside
/opt/hpapache2/lib/..., containing those Apache.pm modules), and Apache seems to add those to
@INC via the environment varable
PERL5_LIB, which is
not interpreted with enabled
TaintChecking. Since I didn't want to dive even deeper into Apache, I pragmatically disabled
TaintChecking, to have the following
@INC library path:
../lib
/home/www/twiki/bin
/opt/hpapache2/lib/perl/lib/site_perl/5.6.1/PA-RISC1.1-thread-multi
/opt/hpapache2/lib/perl/lib/5.6.1/PA-RISC1.1-thread-multi
/opt/hpapache2/lib/perl/lib/5.6.1
/opt/hpapache2/lib/perl/lib
/opt/perl/lib/5.6.1/PA-RISC1.1-thread-multi
/opt/perl/lib/5.6.1
/opt/perl/lib/site_perl/5.6.1/PA-RISC1.1-thread-multi
/opt/perl/lib/site_perl/5.6.1
/opt/perl/lib/site_perl
.
So, my tip is: Try to disable
TaintChecking in
httpd.conf
# This is for mod_perl 2.0
#PerlSwitches -T
# This is for mod_perl 1.0
#PerlTaintCheck On
Good luck!
--
IngoKarkat - 27 Mar 2003
Unfortunately not... I had already disabled
TaintChecking and had been testing without it.
By the way, I know that mod_perl is working on some simple CGI scripts that I experimented with. So I assume this must be some problem related to the complexity of the TWiki scripts and my mod_perl not working 100% ok (maybe :-).
--
DimaDiall - 27 Mar 2003
I found another hint for you. (BTW, I'm still struggling with my mod_perl installation, it's not 100% perfect, right now some searches (
%SEARCH{...}%) yield no return when executed under mod_perl.)
Cp.
mod_perl 2.0 Documentation
:
Error about not finding Apache.pm with CGI.pm
You need to install at least version 2.87 of CGI.pm to work under mod_perl 2.0, as earlier CGI.pm versions aren't mod_perl 2.0 aware.
--
IngoKarkat - 02 Apr 2003
If someone can define the required logic to check the CGI.pm version and mod_perl version (not sure how to check the latter), I'm happy to put in a check in
testenv for what Ingo says above. There's already a similar version check for CGI.pm versions with an upload bug on Windows. This is part of the
ImproveTestenv effort.
--
RichardDonkin - 18 Jul 2003
Hey Richard, stick this right after you calc $USE_MOD_PERL:
my $MOD_PERL_VERSION = eval 'use mod_perl; return $mod_perl::VERSION' if $USE_MOD_PERL;
my $CGI_VERSION = eval 'use CGI qw(version); return version';
You will just need to add a if statement wherever to give a warning. I'm sure there are more elegant ways to do this...
--
ImranNiazi - 30 Jul 2003
Thanks for the code - I don't have mod_perl so testing this is difficult, but if you try the attached patch file, or
CVSget:bin/testenv
(you may need to go to the real CVS since web CVS is 24 hours behind at present), this code is now included. Currently it just displays the mod_perl version - if you can tell me exactly what version range corresponds to mod_perl 2.0 (I think it's 1.99.xxx?) I'll then put in the code to recommend the CGI.pm version (already detects the CGI.pm version).
--
RichardDonkin - 30 Jul 2003
The 2.0 release started at 1.99_01 or something. basically:
/^1\.99/
--
ImranNiazi - 30 Jul 2003
I've committed some code based on this to CVS - recommends CGI.pm 2.90 if using mod_perl 2.0, since 2.90 also fixes some Cygwin Perl attachment problems. Please get the latest
TWikiAlphaRelease from CVS and give it a test under mod_perl 2.0 if possible.
--
RichardDonkin - 31 Jul 2003
You may find my question and answer in
ModPerlOnRedHat90 interesting.
--
AleksanderAdamowski - 09 Oct