AN HTTPD ゲストブック/コメント集(2004年1月23日20:27)


いと gfh05223@nifty.com 2004/01/24 16:25

てっちんさん

以下のようなストーリーでそういうことが起きる可能性があります。

1. 以下のような hello.cgiのソースがある。

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "<HTML><H1>Hello! WORLD</H1>\n";
print "</HTML>\n";

2. これが hello.cgi.txt というファイル名でリンクされている。
 本物の hello.cgi.txtの実例

3. IEで上のリンクをクリックすると以下のように表示される。
 (このときブラウザでソース表示をすれば両者の違いが分かると思います)

#!/usr/local/bin/perl print "Content-type: text/html\n\n"; print "
Hello! WORLD
\n"; print "\n";

4. これを Copy&Paste して自分のパソコン上に hello.cgi を作った。
 誤った hello.cgiの実例

細かいところは違うかもしれませんが、このようなことをしたのであれば
2. でクリックではなく右クリックし、ファイルを保存すれば OKでしょう。
あるいは 1.のソースくらいならを自分で打ち込んでも構いませんし。

#昔々なら IE以外のブラウザを使うというのも回答の一つだったでしょうが。


中田昭雄 nakata@st.rim.or.jp 2004/01/24 09:53

てっちんさん、
どこをどうしたらいいかと言うと、
hello.cgi の中身の文法エラーを、そのエラーメッセージにしたがって直せばよいのです。


てっちん meguminoie@mtj.biglobene.jp 2004/01/23 20:27

なかったさん!!すいません!!初心者です!!
教えてください!!
こんなのが出ます。どこをどうしたらいいんですか??
CGI エラー - Content-Type ヘッダが正しくありません。
CGI 出力メッセージ:

Backslash found where operator expected at C:\www\home\hello.cgi line 3, near "W 
ORLD
\"
(Missing semicolon on previous line?)
String found where operator expected at C:\www\home\hello.cgi line 3, near "n";
print ""
Backslash found where operator expected at C:\www\home\hello.cgi line 3, near ""
; print "\"
(Missing operator before \?)
String found where operator expected at C:\www\home\hello.cgi line 3, at end of
line
(Missing semicolon on previous line?)
syntax error at C:\www\home\hello.cgi line 2, near "Hello!"
Can't find string terminator '"' anywhere before EOF at C:\www\home\hello.cgi li
ne 3.