You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Thomas Hilbig <th...@yahoo.com> on 2006/05/05 20:12:42 UTC

Reinstall gets Can't locate Apache.pm

I had an old problem with a backup server that I am
trying to fix while updating perl, Apache, and
mod_perl2.  My CGI scripts worked under Apache/MP2,
however, everytime I tried to run them from in a shell
I got "Can't locate Apache.pm".   This was even though
I had installed Bundle::Apache2 and CGI was 3.16.

I tried to reinstall CGI, Bundle::Apache2, but still
got the error.  Finally, I renamed the /usr/lib/perl5
directory and am trying to reinstall Perl 5.8.8 from
source tar.  However, in the "make test" section I am
still getting the same errors on all CGI modules:
"Can't locate Apache.pm". 

Any suggestions??
Tom

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Reinstall gets Can't locate Apache.pm

Posted by Thomas Hilbig <th...@yahoo.com>.
--- Thomas Schindl <to...@gmx.at> wrote:

> Why do you have set MOD_PERL in the environment when
> running on the command
> line? Whether it's Apache or Apache2 doesn't matter
> it doesn't make sense to
> run modules which rely on apache-API from the
> commandline does it?
> 
> Tom
> 
The scripts use CGI.pm and haven't been converted to
MOD_PERL handlers -- yet.  Since CGI.pm allows you to
test scripts via the command line, it makes sense to
do so during the initial development of complex
scripts.  I guess MP doesn't support the same command
line emulation, so I agree that it doesn't make sense
to have the two environment variables defined outside
of the Apache environment.  

Tom

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Reinstall gets Can't locate Apache.pm

Posted by Thomas Schindl <to...@gmx.at>.
Why do you have set MOD_PERL in the environment when running on the command
line? Whether it's Apache or Apache2 doesn't matter it doesn't make sense to
run modules which rely on apache-API from the commandline does it?

Tom

> --- Ursprüngliche Nachricht ---
> Von: Thomas Hilbig <th...@yahoo.com>
> An: mod_perl list <mo...@perl.apache.org>
> Betreff: Re: Reinstall gets Can't locate Apache.pm
> Datum: Fri, 5 May 2006 13:15:05 -0700 (PDT)
> 
> 
> 
> --- Tyler MacDonald <ty...@ca.sophos.com> wrote:
> 
> > Thomas Hilbig <th...@yahoo.com> wrote:
> > > I was getting the error even from running perl
> > > interactively
> > > linux>perl
> > > use CGI ;
> > > Can't locate Apache.pm in @INC
> > > 
> > > I think the problem may be that I am simply
> > missing
> > > the MOD_PERL_API_VERSION environment variable in
> > my
> > > shell environment.  I had MOD_PERL set in my shell
> > > environment (from when??), but not the other.
> > > 
> > > Hopefully, I haven't butchered my Perl install
> > beyond
> > > repair.
> > 
> > 	Weird! Are you running the latest version of CGI?
> > If not, that could
> > be the problem, CGI had to be updated to support
> > mod_perl2.
> > 
> > 	Cheers,
> > 		Tyler
> > 
> Originally I was using CGI 3.16, but the 3.20 has the
> same check:
> 
> if (exists $ENV{MOD_PERL}) {
>   # mod_perl handlers may run system() on scripts
> using CGI.pm;
>   # Make sure so we don't get fooled by inherited
> $ENV{MOD_PERL}
>   if (exists $ENV{MOD_PERL_API_VERSION} &&
> $ENV{MOD_PERL_API_VERSION} == 2) {
>     $MOD_PERL = 2;
>     require Apache2::Response;
>     require Apache2::RequestRec;
>     require Apache2::RequestUtil;
>     require Apache2::RequestIO;
>     require APR::Pool;
>   } else {
>     $MOD_PERL = 1;
>     require Apache;
>   }
> }
> 
> Having the MOD_PERL environment but not having
> MOD_PERL_API_VERSION causes grief.  However, the
> instructions do say it is required so it's my fault
> for not catching it earlier.
> 
> Tom
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

Re: Reinstall gets Can't locate Apache.pm

Posted by Thomas Hilbig <th...@yahoo.com>.

--- Tyler MacDonald <ty...@ca.sophos.com> wrote:

> Thomas Hilbig <th...@yahoo.com> wrote:
> > I was getting the error even from running perl
> > interactively
> > linux>perl
> > use CGI ;
> > Can't locate Apache.pm in @INC
> > 
> > I think the problem may be that I am simply
> missing
> > the MOD_PERL_API_VERSION environment variable in
> my
> > shell environment.  I had MOD_PERL set in my shell
> > environment (from when??), but not the other.
> > 
> > Hopefully, I haven't butchered my Perl install
> beyond
> > repair.
> 
> 	Weird! Are you running the latest version of CGI?
> If not, that could
> be the problem, CGI had to be updated to support
> mod_perl2.
> 
> 	Cheers,
> 		Tyler
> 
Originally I was using CGI 3.16, but the 3.20 has the
same check:

if (exists $ENV{MOD_PERL}) {
  # mod_perl handlers may run system() on scripts
using CGI.pm;
  # Make sure so we don't get fooled by inherited
$ENV{MOD_PERL}
  if (exists $ENV{MOD_PERL_API_VERSION} &&
$ENV{MOD_PERL_API_VERSION} == 2) {
    $MOD_PERL = 2;
    require Apache2::Response;
    require Apache2::RequestRec;
    require Apache2::RequestUtil;
    require Apache2::RequestIO;
    require APR::Pool;
  } else {
    $MOD_PERL = 1;
    require Apache;
  }
}

Having the MOD_PERL environment but not having
MOD_PERL_API_VERSION causes grief.  However, the
instructions do say it is required so it's my fault
for not catching it earlier.

Tom

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Reinstall gets Can't locate Apache.pm

Posted by Tyler MacDonald <ty...@ca.sophos.com>.
Thomas Hilbig <th...@yahoo.com> wrote:
> I was getting the error even from running perl
> interactively
> linux>perl
> use CGI ;
> Can't locate Apache.pm in @INC
> 
> I think the problem may be that I am simply missing
> the MOD_PERL_API_VERSION environment variable in my
> shell environment.  I had MOD_PERL set in my shell
> environment (from when??), but not the other.
> 
> Hopefully, I haven't butchered my Perl install beyond
> repair.

	Weird! Are you running the latest version of CGI? If not, that could
be the problem, CGI had to be updated to support mod_perl2.

	Cheers,
		Tyler

Re: Reinstall gets Can't locate Apache.pm

Posted by Thomas Hilbig <th...@yahoo.com>.
> > I did follow the instructions in the link (some
> months
> > ago) when migrating from mp 0.99 to mp2, and lived
> > with the command line problem.  However, as I am
> > trying to reinstall everything (perl included) I
> don't
> > know why am seeing this problem at all.  Any
> > suggestions?
> 
> 	Thomas,
> 
> 		The problem isn't with your /lib/ tree at all, it
> has to be
> with your code. One of your perl modules, or a
> module you are using, is
> trying to "use Apache", when it shouldbe "use
> Apache2::RequestRec" or some
> such thing.
> 
> 			- Tyler
I was getting the error even from running perl
interactively
linux>perl
use CGI ;
Can't locate Apache.pm in @INC

I think the problem may be that I am simply missing
the MOD_PERL_API_VERSION environment variable in my
shell environment.  I had MOD_PERL set in my shell
environment (from when??), but not the other.

Hopefully, I haven't butchered my Perl install beyond
repair.

Thanks for your help,
Tom

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Reinstall gets Can't locate Apache.pm

Posted by Tyler MacDonald <ty...@yi.org>.
Thomas Hilbig <th...@yahoo.com> wrote:
> > 	Ack! Before you drive yourself nuts with this, read
> > this page:
> > 
> > 	http://perl.apache.org/docs/2.0/rename.html
> I shouldn't have to clean up the perl tree of old
> Apache*.pm stuff as I blew away the whole tree by
> renaming it.  Now, it's the perl 5.8.8 install (make
> test) that is complaining about the Apache.pm. 
> 
> I did follow the instructions in the link (some months
> ago) when migrating from mp 0.99 to mp2, and lived
> with the command line problem.  However, as I am
> trying to reinstall everything (perl included) I don't
> know why am seeing this problem at all.  Any
> suggestions?

	Thomas,

		The problem isn't with your /lib/ tree at all, it has to be
with your code. One of your perl modules, or a module you are using, is
trying to "use Apache", when it shouldbe "use Apache2::RequestRec" or some
such thing.

			- Tyler



Re: Reinstall gets Can't locate Apache.pm

Posted by Thomas Hilbig <th...@yahoo.com>.

--- Tyler MacDonald <ty...@yi.org> wrote:

> Thomas Hilbig <th...@yahoo.com> wrote:
> > I tried to reinstall CGI, Bundle::Apache2, but
> still
> > got the error.  Finally, I renamed the
> /usr/lib/perl5
> > directory and am trying to reinstall Perl 5.8.8
> from
> > source tar.  However, in the "make test" section I
> am
> > still getting the same errors on all CGI modules:
> > "Can't locate Apache.pm". 
> 
> 	Ack! Before you drive yourself nuts with this, read
> this page:
> 
> 	http://perl.apache.org/docs/2.0/rename.html
> 
> 	Cheers,
> 		Tyler
> 

I shouldn't have to clean up the perl tree of old
Apache*.pm stuff as I blew away the whole tree by
renaming it.  Now, it's the perl 5.8.8 install (make
test) that is complaining about the Apache.pm. 

I did follow the instructions in the link (some months
ago) when migrating from mp 0.99 to mp2, and lived
with the command line problem.  However, as I am
trying to reinstall everything (perl included) I don't
know why am seeing this problem at all.  Any
suggestions?


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Reinstall gets Can't locate Apache.pm

Posted by Tyler MacDonald <ty...@yi.org>.
Thomas Hilbig <th...@yahoo.com> wrote:
> I tried to reinstall CGI, Bundle::Apache2, but still
> got the error.  Finally, I renamed the /usr/lib/perl5
> directory and am trying to reinstall Perl 5.8.8 from
> source tar.  However, in the "make test" section I am
> still getting the same errors on all CGI modules:
> "Can't locate Apache.pm". 

	Ack! Before you drive yourself nuts with this, read this page:

	http://perl.apache.org/docs/2.0/rename.html

	Cheers,
		Tyler