CGI.pm で Web アプリを開発しました。mod_perl2 に切り替えたいです。私の webapp は CGI で動作しましたが、mod を変更しようとすると、mod_perl で実行する apache conf ファイルを除いて、webapp で何も変更していないのに動作しなくなりました。
mod-perl2 をインストールし、VirtualHost を次のように構成しました。
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>
私のスクリプトは次のようになります。彼は /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 はログにエラーを書き込みます:
[Thu Feb 3 17:35:13 2011] -e: DBI connect(':','',...) failed: アクセスがユーザー 'www-data'@'localhost' (使用パスワード: NO) に対して拒否されましたlib/Connexion.pm 134行目
私が持っているブラウザで:
lib/Search.pm の 51 行目で未定義の値に対してメソッド "prepare" を呼び出せません。
スクリプトがデータベースに接続できないことは理解していますが、なぜですか? mod_cgi で動作していました。誰かがアイデアを持っている場合:'(ありがとう。