下面是一个非常简单的index.html文件夹:C:\ Program Files(x86)\ Apache Software Foundation \ Apache2.2 \ htdocs
<!DOCTYPE html>
<html >
<head>
<script>
xmlhttp=new XMLHttpRequest();
var url = "printenv.pl";
xmlhttp.open("GET", url, true);
//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/text");
xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
alert(xmlhttp.responseText);
}
}
xmlhttp.send();
</script>
</head>
<body >
</body>
</html>
printenv.pl位于C:\ Program Files(x86)\ Apache Software Foundation \ Apache2.2 \ cgi-bin
对于配置文件,我将C:\ Program Files(x86)\ Apache Software Foundation \ Apache2.2 \ conf \ original \ httpd.conf复制到父conf文件夹并更改了2个位置,如下所示: 第193行:
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
我删除了2行:
Order allow,deny
Allow from all
第343行:
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
我将此部分更改为:
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options +ExecCGI
AddHandler cgi-script .cgi .pl
Allow from all
</Directory>
我收到了错误 “GET http:/ / localhost / printenv.pl 403(Forbidden)。” 我正在使用Win2k3 64位,Apache2.2,以管理员帐户登录。有人可以帮帮我吗?很抱歉重复这个问题,但我做了一些修改以简化问题以吸引更多人的注意。