让 mod_perl 在普通的 ubuntu 10.04 服务器安装上运行,

让 mod_perl 在普通的 ubuntu 10.04 服务器安装上运行,

我正在尝试在全新安装的 Lucid Lynx(ubuntu 10.04)上启用 mod_perl。

我已经安装了 libapache2-mod-perl2,但是似乎无法运行 .pl 文件,而只能下载它。

-Perl 5.10.1

阿帕奇 2

我在安装时安装了“LAMP”配置。

答案1

mod_perl 可能不是您要找的。perl 脚本是否设计为与 mod_perl 一起运行,或者它是一个 cgi 脚本?

首先,让我们假设它是一个 cgi 脚本,并不是真正要作为 mod_perl 运行。如果是这样,您可以在配置块中输入:

<Directory /path/to/webroot/>
Options +ExecCGI
AddHandler cgi-script .pl
</Directory>

如果脚本顶部有一个正确的 #!/usr/bin/perl 行,并且能够执行,那么 apache 应该将其作为 CGI 脚本提供。

然而,如果你确实想要使用 mod_perl,你通常需要在 VirtualHost 配置中编写一个处理程序,例如:

<Location /virtualpath>
SetHandler modperl
PerlResponseHandler modulename::Function
</Location>

你可能还需要输入:

PerlRequire /path/to/startupscript.pl

修复环境。通常,mod_perl 处理程序是 .pm 文件,并且是包,而不是 .pl 文件。

相关内容