I developped a web app under CGI.pm.I'd like to switch to mod_perl2. My webapp worked under CGI but when i tried to change the mod, it's not working anymore while I didn't change anything in the webapp ,except the apache conf files to run under mod_perl.
I have installed mod-perl2 and configure my VirualHost like this :
Alias /project1/ /var/www/v6/cgi-bin/
PerlModule Apache::DBI
PerlModule ModPerl::RegistryPrefork
<Directory /var/www/v6/cgi-bin/ >
PerlOptions -SetupEnv
SetHandler perl-script
PerlResponseHandler ModPerl::RegistryPrefork
PerlOptions +ParseHeaders
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
My script looks like . he uses some modules in /v6/cgi-bin/lib/
#!/usr/bin/perl
use lib qw(lib);
use strict;
use DBI;
use CGI;
use Template;
use CGI::Carp qw(fatalsToBrowser);
use Data::Dumper;
use Connexion;
use Search;
my $cgi = new CGI;
our $fastdb = Connexion::database('1','1');
my $get_description__id_sth = Search->get_description_id_sth();
Apache2 write the error in the log :
[Thu Feb 3 17:35:13 2011] -e: DBI connect(':','',...) failed: Access denied for user 'www-data'@'localhost' (using password: NO) at lib/Connexion.pm line 134
In the browser i have :
Can't call method "prepare" on an undefined value at lib/Search.pm line 51.
So i understand that the script can't connect to the database.But why? It was working on mod_cgi. If someone has an idea :'( Thanks.
What is Connexion and what is it doing in the DBI connect call?
You very likely need to not be disabling SetupEnv.