让 Apache::ASP 在 OSX Lion Server 中运行 - 针对 Mountain Lion 进行了更新
我正在尝试让 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 handler 或 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)
UPDATE #2 :
Apache::ASP 与 IIS 上的一些 ServerVariables 未定义。语法与预期略有不同。下面将列出所有可用的服务器变量...
my $variables = $Request->{ServerVariables};
print join '<br>', sort keys %$variables;
I am trying to get Apache::ASP running on OSX Lion Server. I have made a fresh install of OSX Lion VM in Fusion 4, installed the Xcode app (with command line tools), and run the following shell commands:
sudo perl -MCPAN -e shell
cpan> install CPAN
cpan> install Bundle::Apache::ASP
I've add to end of the httpd.confg files (/Library/Server/Web/Config/apache2/httpd_server_app.conf and
/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>
But either adding the set handler or perlhandler causes Apache not to restart. Take them both out and Apache starts, but serves an .asp file as a text file....
UPDATE #1:
Oops, twenty or thirty:
sudo apachectl restart
and I didn't even have mod perl running. Adding the below to the httpd.conf file got Apache to start:
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} will now return a value, but....
%test = $Request->ServerVariables(); #or $Request->ServerVariables(URL);
%><%= $test %><%
Outputs: Apache::ASP::Collection=HASH(0x7f84114c58d8)
UPDATE #2:
Several of the ServerVariables are undefined on Apache::ASP vs. IIS. The syntax is slightly different than expected. Below will list all available server variables...
my $variables = $Request->{ServerVariables};
print join '<br>', sort keys %$variables;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案已添加到问题中,但简短的答案是 mod perl 必须正在运行(并且默认情况下不会在 OS X Lion 上启动...
Solution has been added to question, but the short answer is that mod perl must be running (and does not start by default on OS X Lion...