0

尊敬されるppl..。

openSUSE 12.2を使用していて、Apacheサーバーが正常に実行されています...

以下を含むindex.htmlをコピーしました:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Program 7b</title></head>
<body>
<form method="POST" action="http://localhost/cgi-bin/7b.pl">
    Please Enter the Command :
    <input type="text" name="command" id="command" />
    <input type="submit" value="Submit" />
</form>
</body>
</html>

そして、perlファイルは次のとおりです。

#!/usr/bin/perl

print "Content-type:text/html\n\n";
use CGI

$a = new CGI;
$comm = $a->param("command");
print "The Output of the entered command is:<br />";
system($comm);

cgi-binディレクトリ内の両方のファイル

しかし、私はエラーを受け取ります:

スクリプトヘッダーの早期終了任意のブラウザでlocalhost/cgi-bin/index.htmlを実行すると...。

私はapache構成でperlファイルの実行を設定しました...

親切に問題を手伝ってください...

よろしく-SkyKOG

4

2 に答える 2

0

Apacheは、単にHTMLドキュメントを表示するのではなく、スクリプトとしてindex.htmlを実行しています。Apacheは、おそらくcgiディレクトリ内のすべてのものをスクリプトとして実行するように設定されています。

htmlファイルを別のディレクトリに移動します。

于 2012-10-15T20:21:25.993 に答える
0

次の作業コードを試してください。

#!/usr/bin/perl
use strict; use warnings;
use CGI;

print "Content-type:text/html\n\n";

my $a = new CGI;
my $comm = $a->param("command");

print "The Output of the entered command is:<br />";
system($comm);

アドバイス:またはを使用して変数を忘れずuse strict; use warnings;に宣言してください。myour

于 2012-10-15T20:30:38.717 に答える