经历了许多过时的帖子。在我的widows 7 PC上配置apache服务器仍有问题。
任何帮助。
得到以下错误:
Forbidden
You don't have permission to access /test.pl on this server.
日志文件:
[Wed Mar 12 11:31:11.500316 2014] [cgi:error] [pid 2008:tid 1048] [client ::1:57646] Options ExecCGI is off in this directory: C:/Program Files/Apache Software Foundation/Apache2.4/htdocs/test.pl
在apache 2.4.3 httpd.conf文件中添加ExecCGI的位置。
路径:C:\Program Files\Apache Software Foundation\Apache2.4\cgi-bin
是否需要安装'mod_perl'? 如何配置apache?
答案 0 :(得分:0)
没有必要安装mod_perl。但是你的Perl程序必须在顶部有一个shebang行,它可以从命令行运行,因为' test.pl'
通常我们不会将CGI程序放在文档根目录(htdocs
)中。
查看您的Apache配置,您可能会发现配置名为cgi-bin
的目录,即ExecCGI到达设置。在你的情况下,它看起来像:
C:\Program Files\Apache Software Foundation\Apache2.4\cgi-bin
将您的计划放在那里。确保您的程序可由apache的用户执行。 在配置文件中进一步查看ScriptAlias设置,该设置将cgi-bin目录映射到URI。通常,这默认为/ cgi-bin。
退回apache,然后访问http://your.site/cgi-bin/test.pl