我有一个perl.cgi
文件,该文件具有内容:CGI脚本不执行
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<h1>Hello World</h1>\n";
我做到了可执行文件。 (chmod a+x perl.cgi
)
然后我在同一个目录下创建了一个新文件perl.htm
。当我在浏览器中运行的perl.htm
Content-type: text/html
<p><a href="perl.cgi">RUN perl.cgi</a></p>
然后我得到的输出:它具有以下数据
Content-type: text/html
RUN perl.cgi
当我点击RUN perl.cgi
另一个页面打开,有输出为:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<h1>Hello World</h1>\n";
即perl.cgi
未执行。只显示文件内容。
编辑:从答案和评论我来了解,我将不得不配置我的Web服务器(Apache)运行CGI脚本。我怎样才能做到这一点?让我知道。
您需要更详细地描述您的Web服务器设置。 –
投票移动到http://serverfault.com但尝试将文件重命名为'perl.pl'。如果不是这样,你需要正确地配置你的web服务器来执行perl cgi –