Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

mod_perl : Couldnt load Apache.pm

by vc_will_do (Sexton)
on Aug 29, 2007 at 14:57 UTC ( #635815=perlquestion: print w/replies, xml ) Need Help??

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

Hi monks, I am new to mod_perl. I have written a startup script like this.

#!/usr/bin/perl BEGIN { use Bundle::Apache2 (); use Apache::DBI (); } use Apache2::Const -compile => qw(OK); $dbh = Apache::DBI->connect_on_init("DBI:mysql:database=dbname;host=lo +calhost","dbuser","dbpass",{ PrintError => 1, RaiseError => 0, AutoCo +mmit => 1}); 1;
On the line $dbh = Apache::DBI->connect_on_init , I am getting the error
Apache.pm was not loaded at ./startup.pl line 18
I have mod_perl2 installed. Thanks in advance.

Replies are listed 'Best First'.
Re: mod_perl : Couldnt load Apache.pm
by ikegami (Pope) on Aug 29, 2007 at 15:05 UTC

    I don't know much about the topic at hand, so I don't know if this will help the problem you ask about, but Bundle::Apache2 is not meant to be used. It doesn't do anything. It's purpose is to simplify the installation of multiple modules.

    I suspect you might be specifying the wrong module, loading Bundle::Apache2 where you should be loading a different one.

      When I use use Apache; or use Apache2;, Apache2 is NOT loaded. I couldn't find any Apache2.pm on CPAN :(

        The installation of mod_perl is a bit involved - you'll have to go to the mod_perl website in order to get the code and the instructions to install it.


        --chargrill
        s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
Re: mod_perl : Couldnt load Apache.pm
by perrin (Chancellor) on Aug 29, 2007 at 15:36 UTC
    Don't load that Bundle file. Load Apache::DBI from your startup.pl before you load anything else. Apache.pm will be loaded automatically by mod_perl, so you don't need to load it yourself. Make sure you have the latest versions of mod_perl and Apache::DBI.

      Thanks for your time. Now my startup.pl looks like

      #!/usr/bin/perl BEGIN { use Apache::DBI; } $dbh = Apache::DBI->connect_on_init("DBI:mysql:database=dbname;host=lo +calhost","dbuser","dbpass",{ PrintError => 1, RaiseError => 0, AutoCo +mmit => 1}); 1;
      Still have same error - "Apache.pm was not loaded". I have installed mod_perl from apache.org today and Apache::DBI from CPAN. So I thing both are latest packages.

        At the top of my startup.pl file, I have:

        BEGIN { use Apache(); # ... }

        Seems I was steering you wrong, thinking you hadn't installed mod_perl yet.


        --chargrill
        s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
Re: mod_perl : Couldnt load Apache.pm
by vc_will_do (Sexton) on Aug 29, 2007 at 17:30 UTC

    Thanks everybody for your time. I had a version collision. I installed (from source) 2.0.3 and later our admin installed 2.0.2 of modperl :( Now I removed both and re installed 2.0.3 and works fine. Thanks to all monks :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2019-10-20 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?