我在 CGI.pm 下开发了一个网络应用程序。我想切换到 mod_perl2。我的 webapp 在 CGI 下工作,但是当我尝试更改 mod 时,它不再工作,而我没有更改 webapp 中的任何内容,除了在 mod_perl 下运行的 apache conf 文件。
我已经安装了 mod-perl2 并像这样配置我的 VirualHost:
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: Access denied for user 'www-data'@'localhost' (using password: NO) at lib/Connexion.pm 第 134 行
在浏览器中我有:
无法在 lib/Search.pm 第 51 行对未定义的值调用方法“prepare”。
所以我知道脚本无法连接到数据库。但是为什么呢?它正在处理 mod_cgi。如果有人有想法:'(谢谢。