Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Apache cannot locate CGI.pm in @INC

by ahoffmann (Initiate)
on May 24, 2005 at 20:31 UTC ( [id://460157]=perlquestion: print w/replies, xml ) Need Help??

ahoffmann has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I am running Red Hat Enterprise 3 ES. I wanted to upgrade Perl that came with the distribution, so I downloaded, compiled, and installed 5.8.6. I also installed Apache 2.0.54 and configured httpd.conf to work with Perl. Perl 5.8.6 is running, confirmed by executing perl --version. I can run perl scripts just fine locally. However, when I try to run a script through Apache over the Internet, I get an Internal Server Error. The error log from Apache is as follows:
[Tue May 24 14:58:29 2005] [error] [client 128.104.4.246] Can't locate + CGI.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-threa +d-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linu +x-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_per +l /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/p +erl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8. +0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at /var/www/html/ad +min/admin.pl line 26., referer: http://sonata.doit.wisc.edu:8080/admi +n/
My 5.8.6 dist of Perl is residing in a completely different place than 5.8.0 (the version that came with Red Hat). I've tried reinstalling both Apache and Perl, and even (painfully) rebooting my machine. Running the scripts on the Apache server that came bundled with Red Hat produced the same problem. Running perl -V gives me the following output:
Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=linux, osvers=2.4.21-32.el, archname=i686-linux uname='linux sonata.doit.wisc.edu 2.4.21-32.el #1 fri apr 15 21:29 +:19 edt 2005 i686 i686 i386 gnulinux ' config_args='-d' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultipl +icity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include + -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -I/usr/local/include -I/usr/i +nclude/gdbm' ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-52)' +, gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl. +a gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at May 24 2005 12:21:23 @INC: /usr/local/lib/perl5/5.8.6/i686-linux /usr/local/lib/perl5/5.8.6 /usr/local/lib/perl5/site_perl/5.8.6/i686-linux /usr/local/lib/perl5/site_perl/5.8.6 /usr/local/lib/perl5/site_perl .
The @INC is pointing to 5.8.6 here, so why is Apache still pointing to 5.8.0?

I appreciate any assistance,

Andrew Hoffmann
University of Wisconsin

Replies are listed 'Best First'.
Re: Apache cannot locate CGI.pm in @INC
by djohnston (Monk) on May 24, 2005 at 22:13 UTC
    I had a similar problem after upgrading perl on my rh9 box. My solution was:
    mv /usr/bin/perl /usr/bin/perl-5.8.0 cp /usr/local/bin/perl /usr/bin/perl-5.8.6 ln -s /usr/bin/perl-5.8.6 /usr/bin/perl
    ...restart apache. Note, however that there is probably a right way to do it and my money says that this solution is not it - but it might at least provide you with a temporary solution.
Re: Apache cannot locate CGI.pm in @INC
by bart (Canon) on May 24, 2005 at 20:45 UTC
    Is that in CGI or in mod_perl? I'm assuming CGI...

    Nowhere do you mention what path your new perl is at, but it definitely looks to me like the scripts are simply using a different version of perl. Put the full path for perl 5.8.6 in the shebang line for the scripts, and it should work. For example:

    #!/usr/local/bin/perl
      Old version of Perl: /usr/bin/perl
      New version of Perl: /usr/local/bin/perl

      I updated the shebang line for the script, but it still gave me the same error.
        Weird.

        Try not using any modules, print the content-type header and blank line yourself, and print your debugging info to the browser window.

Re: Apache cannot locate CGI.pm in @INC
by jpk236 (Monk) on May 24, 2005 at 20:50 UTC
    According to my system, CGI.pm is installed by perl. It's also located in /usr/local/lib/perl5/5.8.6, which is listed in your @INC. Can you verify that CGI.pm actually exists in that folder?
    root:neon|4:46:46pm|~: pkg_info -W /usr/local/lib/perl5/5.8.6/CGI.pm /usr/local/lib/perl5/5.8.6/CGI.pm was installed by package perl-thread +ed-5.8.6_2

    - Justin
      CGI.pm exists in the same directory as listed in your reply. I also went and downloaded the latest version of CGI.pm from CPAN, but that did not fix the problem either.
Re: Apache cannot locate CGI.pm in @INC
by Tanktalus (Canon) on May 25, 2005 at 15:33 UTC

    I have a RHEL3AS box here with Apache on it, never had any problem with CGI. I also use perl5.8.6 installed elsewhere. No problem with that, either.

    So I suppose the big question to me is ... are you running apache in a chroot jail? What user is apache running as - does that user somehow not have access to read some of these directories?

    Update: I highly doubt that kyoshu's advice will help, given the OP's description, but I will grant that it's really easy to try (at least the symlink part).

      the easiest way to fix your problem would be to create a symlink perl5.8.0 -> perl5.8.6, or you can try to reinstall apache.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://460157]
Approved by Paladin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-28 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found