カスタム検索
|
Tweet |
|
|
Perl(cgi)がうまく実行できない
Modified: 30 April 2004
"httpd.conf"を確認する
RedhatLinux9.0 のApacheでは、cgi の実行が禁止になっているようです。
"/etc/httpd/conf/httpd.conf" を変更し、実行できるようにします。
: # # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/var/www/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory>:「Options」が、「Options None」となっていますので、以下のように、「Options Indexes FollowSymLinks」と変更します。
: # # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/var/www/cgi-bin"> AllowOverride None Options Indexes FollowSymLinks Order allow,deny Allow from all </Directory>:
Perlスクリプトの内容確認
#!/usr/bin/perl -w print "Content-Type: text/html\n\n"; :
解説
先頭のperlのオプションとして、"-w"をつけます。オプションとしてはたいした意味を持たないと感じますが、このオプションをつかないとうまく動作しません。
出力されるHTMLイメージの先頭に、"Content-Type: text/html" を付加する必要があります。