60歳からITエンジニアを目指す無謀なブログ

60歳で定年し、職種を変更してIT技術者を目指すブログです。

index.cgiを実行時にエラーEnd of script output before headers: index.cgi

 

End of script output before headers: index.cgi

 

index.cgi--------  permission 777

#!/usr/bin/python3

print ('Content-type: text/html\n')
print ("Test Response")

 

.htaccess --------------- permission  644

DirectoryIndex index.cgi index.php index.htm index.html index.shtml
Options ExecCGI
Require all granted

 

これをサーバのディレクトリアクセスして実行すると

”End of script output before headers: index.cgi”エラー

が出力されます

 

そこでindex.cgiパーミッションを705に変更すると

エラーが消え解決されました。 原因は不明です。

 

さらにこのindex.cgiがおいてあるカレントディレクトリ"."のパーションの

GuestユーザのパーミッションをWアクセス可能にすると同様に

”End of script output before headers: index.cgi”エラー

が出力されます

 

これから予想すると、CGIファイルにはライトパーミッション

不可してはだめなのか、もしくはどこかのhttpd.confに制限が掛けてあり、それと矛盾している設定のためこのようなエラーが出るのかも知れません。