Re: Weird issue with DBI mysql driver under mod_perl

"Bruce Johnson" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Yes I have that set, and my PerlRequire file is pretty minimal:

#!/usr/bin/perl
use lib qw(/usr/lib64/perl5 /usr/share/perl5 /usr/local/lib64/perl5 /home/allwebfiles/perl/LocalModules /usr/lib64/perl5/vendor_perl/Bundle);
use CGI ();
use PharmApps::CleanCGI ();
CGI->compile(':all');
use DBI ();
use Apache2;
1;

This is similar to the one I’ve used on another production server for some time without issues, but that one doesn’t use MySQL, only Oracle.

As I said other mod_perl applications on this same server are working as expected; this issue seems to be strictly with the DBD::mysql file for DBI.


On Jun 3, 2020, at 11:25 AM, Bill Hess <[email protected]<mailto:[email protected]>> wrote:

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<http://apache.pl/>


And the file /path/to/my/conf/files/apache.pl<http://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]<mailto:[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<http://choose.pl/> line 54.\n

This is a really wrong error,  since the DBD/mysql.pm<http://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



--
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.