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

Following a tip on another monks node "Tricks with DBI", I went the route to start using persistent database connections with Apache and DBI.

I installed the prebuilt mod_perl 1.27 and added:

LoadModule perl_module modules/mod_perl.so

...to Apache's 1.3.x httpd.conf file.

I've also added the:

use Apache::DBI;

...to my pm just above my 'use DBI;' call. However, now that I have this in place, any time that I invoked a DBI call, I get the following message in the error log:

Can't locate object method "module" via package "Apache" (perhaps you forgot to load "Apache"?) at lib/Apache/DBI.pm line 199.

Any idea what the problem is? All the documentation that I've read on the subject does not discuss (in depth or detail) the changes that need to be made to the httpd.conf file if doing a manual installation.

TIA

======================
Sean Shrum
http://www.shrum.net

Replies are listed 'Best First'.
Re: mod_perl and Apache::DBI - Installation help
by PodMaster (Abbot) on May 18, 2003 at 10:44 UTC
    `perldoc Apache::DBI'
    ... SYNOPSIS

    # Configuration in httpd.conf or startup.pl:

    PerlModule Apache::DBI # this comes before all other modules using DBI

    You might also wanna read cgi_to_mod_perl,mod_perl ... http://perl.apache.org


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      I've read all the sources that you listed and made the following change to my httpd.conf:

      LoadModule perl_module modules/mod_perl.so Alias /cgi-bin/ g:/websites/cgi-bin/ <Location /cgi-bin> SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI </Location> <Files ~ "\.pl$"> SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI </Files> PerlModule Apache::DBI

      Now I'm getting Internal Server Errors on my Apache::DBI scripts. If I remove the Apache::DBI and leave in my DBI clause, DBI functions work.

      Nothing is being generated error log wise so I am a bit stumped on where to go from here.

      Any more help would be apprechiated.

      Settings: SERVER_SOFTWARE: Apache/1.3.24 (Win32) PHP/4.3.1 mod_perl/1.27_01-dev

      TIA

      ======================
      Sean Shrum
      http://www.shrum.net

        To see errors during startup, start httpd manually instead of using a script for it and watch the console.