【发布时间】:2013-01-25 10:09:56
【问题描述】:
在使用apache 和perl cgi scripts 进行配置时,不知道为什么index.cgi/index.pl 显示为纯文本而不是执行它们。
当我将http://localhost 放入浏览器时,它会显示在代码下方,而不是执行它。
List item
#!C:/Dwimperl/perl/bin/perl.exe -w
print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>A perl web page</title>
</head>
<body>
<h3>A hello world form perl</h3>
</body>
HTML
exit;
这是我大部分时间编辑的httpd.conf文件的一部分(在阅读了各种在线参考、教程之后)
# This should be changed to whatever you set DocumentRoot to.
<Directory "D:\webserver">
Listen 80
ServerName localhost:80
LoadModule cgi_module modules/mod_cgi.so
# First, we configure the "default" to be a very restrictive set of
# features.
<Directory />
Options FollowSymLinks +ExecCGI
AllowOverride None
</Directory>
DirectoryIndex index.html index.html.var index.cgi index.pl
AccessFileName .htaccess
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi .pl
ScriptAlias /cgi-bin/ "C:/Apache/Apache2/cgi-bin/"
【问题讨论】:
-
投反对票没关系,但如果你知道答案,请告诉我。我很难配置 httpd.conf 文件。
-
您的 Perl 是否安装正确。如果没有找到您的脚本指定的 perl,Apache 通常会打印文件内容。 http配置很头疼。我同意。
标签: perl apache windows-7 configuration cgi