LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Can't locate object method "require_version" via package "DBI" (https://www.linuxquestions.org/questions/linux-software-2/cant-locate-object-method-require_version-via-package-dbi-4175450993/)

sujeeva 02-20-2013 01:48 PM

Can't locate object method "require_version" via package "DBI"
 
Hi,

I get the following error when attempting to start apache in Linux. This issue appears in some forums but the solution is not clear to me.

I'm in the process of porting the application from AIX to Linux. Please advise.

Thanks in advance,

Sujeeva

[sseneviratne@wlm6hub5app01 dev]$ uname -a
Linux xxxx.xxx.xx 2.6.32-279.5.2.el6.x86_64 #1 SMP Tue Aug 14 11:36:39 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

[Wed Feb 20 14:34:14 2013] [error] Can't locate object method "require_version" via package "DBI" at /usr/local/share/perl5/Apache/DBI.pm line 23.\nCompilation failed in require at /home/sujeeva/rundir/dev/www-rco/conf/startup.pl line 13.\nBEGIN failed--compilation aborted at /home/sujeeva/rundir/dev/www-rco/conf/startup.pl line 13.\nCompilation failed in require at (eval 2) line 1.\n
[Wed Feb 20 14:34:14 2013] [error] Can't load Perl file: conf/startup.pl for server xxxx:0, exiting...

My startup.pl:

#-------------------------------------------------------------------------

BEGIN {
# Make sure to list these backwards!
use lib '/usr/lib64/perl5/Bundle';
use lib '/home/sseneviratne/rundir/dev/rco/lib';
use lib '/home/sseneviratne/rundir/dev/rco/web/apache/lib';
}

#-------------------------------------------------------------------------

use Apache2 ();
use Apache::DBI ();
use Apache2::Log ();
use Apache2::Const qw(:http :common);
use CGI qw(-compile :all);
use CGI::Carp ();

#-------------------------------------------------------------------------
# Initialize the database connections for each child

my $dbhost = Apache->server->dir_config('Database-Host')
or die 'Missing [Database-Host] variable';

my $dbuser = Apache->server->dir_config('Database-User')
or die 'Missing [Database-User] variable';

Apache::DBI->connect_on_init(
"DBI:mysql:rpm:$dbhost",
$dbuser,
'',
{
PrintError => 1, # warn() on errors
RaiseError => 0, # don't die on error
AutoCommit => 1, # commit executes immediately
}
);

#-------------------------------------------------------------------------

1;

Habitual 02-20-2013 02:09 PM

http://search.cpan.org/search?query=dbi&mode=all

sujeeva 02-20-2013 03:42 PM

Habitual, can you please elaborate? The issue here is with the Apache::DBI module.

Habitual 02-20-2013 03:49 PM

DBI.pm is a perl module and it needs to be available to the system.

you should see the same reference to DBI.pm if you
Code:

perl /home/sujeeva/rundir/dev/www-rco/conf/startup.pl
you may simply just need mod_perl from a cursory review of google hits.

OS? apache version installed please.


All times are GMT -5. The time now is 06:21 AM.