Perl脚本不会运行;只是在浏览器中显示实际的代码 [英] Perl script wont run; just displays actual code in the browser
问题描述
我是Perl新手,无法正常运行脚本。我应该在哪里放置实际的Perl脚本才能让它们正确运行?我正在测试我的膝盖上的所有东西,并试图从HTML页面调用脚本,并且我得到的是实际的脚本(代码)本身显示在我的Web浏览器中,而不是代码旨在生成的信息。因此,我想我应该把Perl文件放在别的地方?目前,我将Perl脚本和HTML文件放在同一个目录中。任何帮助将不胜感激!见下:
I am new to Perl and am having trouble getting my scripts to run properly. Where am I supposed to put the actual Perl scripts in order for them to run correctly? I am testing everything out on my lap top and am trying to call a script from a html page and all I get is the actual script (code) itself displayed in my web browser as opposed to the information that the code is designed to produce. Therefore, I figure I am supposed to put the Perl file somewhere else? Currently I have the Perl script and the HTML file in the same directory. Any help would be greatly appreciated! See below:
<head>
<title>Student Web Page</title>
</head>
<body>
<h1>WELCOME! You have reached Kito's Student Web Page</h1>
<br />
<p>To run the folloiwing applications, click on the appropriate line:</p>
<form ACTION="first.pl" METHOD="get">
<p>
<input TYPE="submit" VALUE="Step 5 - Perl Environment Variables">
</p>
</form>
#!c:\perl\bin\perl.exe -w
use strict;
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Environment Variables</TITLE></HEAD><BODY>";
foreach (keys %ENV) {
print "<BR><FONT COLOR=green>$_</FONT> is set to <FONT COLOR=red>$ENV{$_}</FONT>";
}
print "</BODY></HTML>";
推荐答案
您需要配置您的web服务器才能执行CGI文件。这是如何做的取决于网络服务器和操作系统。
You need to configure your webserver to execute the CGI file. How this is done depends on the webserver and operating system.
一些例子:
http://www.thesitewizard.com/archive/addcgitoapache.shtml
这篇关于Perl脚本不会运行;只是在浏览器中显示实际的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!