【发布时间】:2011-12-03 16:01:39
【问题描述】:
我正在尝试让 Apache::ASP 在 OSX Lion Server 上运行。我在 Fusion 4 中全新安装了 OSX Lion VM,安装了 Xcode 应用程序(使用命令行工具),并运行以下 shell 命令:
sudo perl -MCPAN -e shell
cpan> install CPAN
cpan> install Bundle::Apache::ASP
我已添加到 httpd.confg 文件的末尾(/Library/Server/Web/Config/apache2/httpd_server_app.conf 和 /Library/Server/Web/Config/apache2/httpd_server_app.conf.default):
<Files ~ (\.asp)>
SetHandler perl-script
PerlHandler Apache::ASP
PerlSetVar Global .
PerlSetVar StateDir /tmp/asp
</Files>
但是添加 set 处理程序或 perlhandler 会导致 Apache 不重新启动。把它们都拿出来,Apache 就会启动,但将 .asp 文件作为文本文件提供......
更新 #1:
哎呀,二十或三十:
sudo apachectl restart
我什至没有运行 mod perl。将以下内容添加到 httpd.conf 文件可以启动 Apache:
LoadModule perl_module libexec/apache2/mod_perl.so
Alias /perl/ /Library/WebServer/Documents/perl/
<Location /perl/>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
Order allow,deny
Allow from all
</Location>
$Request->{Method} 现在将返回一个值,但是....
%test = $Request->ServerVariables(); #or $Request->ServerVariables(URL);
%><%= $test %><%
输出:Apache::ASP::Collection=HASH(0x7f84114c58d8)
更新 #2:
Apache::ASP 与 IIS 上的几个 ServerVariables 未定义。语法与预期略有不同。下面将列出所有可用的服务器变量...
my $variables = $Request->{ServerVariables};
print join '<br>', sort keys %$variables;
【问题讨论】:
标签: perl apache asp-classic osx-lion