Re: Weird issue with DBI mysql driver under mod_perl

Bill Hess <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CANAxc83zzROxKROWF9tfNDQoPStO0d8OuBNBrrKDk=u56b1uGg@mail.gmail.com>
This MIGHT be the problem...

If you have some lines like this in your Apache httpd.conf

PerlModule     mod_perl2
PerlRequire    /path/to/my/conf/files/apache.pl



And the file /path/to/my/conf/files/apache.pl  should look  something like

#!/usr/bin/perl

use ModPerl::Util ();
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
use Apache2::ServerRec ();
use Apache2::ServerUtil ();
use Apache2::Connection ();
use Apache2::Log ();
use Apache2::Const -compile => ':common';
use APR::Const     -compile => ':common';
use APR::Table ();

use DBI;

# Perhaps some other modules you are using in your CGI scripts...


1;



On Wed, Jun 3, 2020 at 1:53 PM Bruce Johnson <[email protected]>
wrote:

> I’m migrating a bunch of old cgi web apps to a new server (CentOS8) and
> running them under mod_perl.
>
> one of them uses the DBD::mysql driver and when running under mod_perl
> only I get the strange error:
>
> [Tue Jun 02 10:29:32.289698 2020] [:error] [pid 3729:tid 140210163652352]
> DBD::mysql initialisation failed: Can't locate object method "driver" via
> package "DBD::mysql" at /usr/lib64/perl5/vendor_perl/DBI.pm line
> 827.\n\nPerhaps the capitalisation of DBD 'mysql' isn't right. at
> /home/allwebfiles/perl/badges/choose.pl line 54.\n
>
> This is a really wrong error,  since the DBD/mysql.pm script quite
> clearly has a sub called ‘driver’ and there is no isssue of capitalization
> in the database handle creation.
>
> the handler code in my perl.conf file is pretty simple:
>
>   <Location /badges/>
>     SetHandler perl-script
>     PerlHandler ModPerl::Registry
>     Options ExecCGI
>     PerlSendHeader On
>     allow from all
>   </Location>
>
> And it works for other locations, although this is the only one using the
> mysql driver, but DBD::Oracle works fine for a number of other scripts.
>
> If I comment out the handler in perl.conf, add it as a ScriptAlias to run
> as a CGI script, it works. If I run the script itself on the command line,
> it works. I only get that error when I run it with a mod_perl handler.
>
> I've asked on the DBI list and no one there has any ideas...
>
> --
> Bruce Johnson
> University of Arizona
> College of Pharmacy
> Information Technology Group
>
> Institutions do not have opinions, merely customs
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.