I'm using Apache and send an ajax request using jQuery from index.html
. The get_data.pl
is a file on cgi-bin
. I got 403 Forbidden error
. Anyone would help me and thanks in advance.
$.ajax({
async : true,
type: "GET",
url: "get_data.pl"
}).done(function(msg){
alert("Data Saved: " + msg);
}).fail(function(xmlHttpRequest,statusText,errorThrown) {
console.log(JSON.stringify(xmlHttpRequest));
console.log(statusText);
console.log(errorThrown);
});
What I got from the console:
{"readyState":4,"responseText":"<!DOCTYPE ...<title>403 Forbidden</title>...
<p>You don't have permission to access /get_data.pl
on this server.</p>
</body>
</html>
","status":403,"statusText":"Forbidden"}
It's Windows 7. I'm running with Chrome using administrator account.
After some time, I didn't find ways for the issue yet. I think I should provide more details for experts to reproduce my problem.
About my httpd.conf, I changed places based on the original one:
Line 193 in:
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
I delete the 2 lines:
Order allow,deny
Allow from all
Line 343 :
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
I changed this section to:
<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>
I placed the .pl file in cgi-bin folder, the index.html in htdocs folder.
I tried Windows7, Win2k3 64bit and WIn2k3 32bit. All have forbidden errors. I used Apache's default printenv.pl also.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…