[英]Perl script wont run; just displays actual code in the browser
I am new to Perl and am having trouble getting my scripts to run properly. 我是Perl的新手,无法正常运行脚本。 Where am I supposed to put the actual Perl scripts in order for them to run correctly?
我应该在哪里放置实际的Perl脚本以使其正确运行? 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.
我正在测试笔记本电脑上的所有内容,并尝试从html页面调用脚本,而我得到的只是显示在Web浏览器中的实际脚本(代码)本身,而不是该代码旨在产生的信息。 Therefore, I figure I am supposed to put the Perl file somewhere else?
因此,我认为我应该将Perl文件放在其他位置? Currently I have the Perl script and the HTML file in the same directory.
目前,我在同一目录中有Perl脚本和HTML文件。 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>";
You need to configure your webserver to execute the CGI file. 您需要配置Web服务器以执行CGI文件。 How this is done depends on the webserver and operating system.
如何完成此操作取决于Web服务器和操作系统。
Some examples: http://www.thesitewizard.com/archive/addcgitoapache.shtml 一些示例: http : //www.thesitewizard.com/archive/addcgitoapache.shtml
Under linux with apache install the mod_cgi module. 在具有apache的Linux下,安装mod_cgi模块。 Under windows with IIS install activestate perl.
在带有IIS的Windows下,安装activestate perl。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.