私はApache2 Webサーバーで単純なPythonスクリプトを実行しようとしています。しかし、私はエラーの後になる。助けてください、私はそれを取得しません。ありがとうございました。Apache2 + Python
ファイル:
print('Content-Type: text/html; charset=utf-8\n')
print()
print("Hello, World!")
ブラウザエラー
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
エラー・ログ・
[Fri May 13 13:35:05.520836 2016] [cgi:error] [pid 12967] [client ::1:41077] AH01215: (8)Exec format error: exec of '/var/www/html/index.py' failed
[Fri May 13 13:35:05.522775 2016] [cgi:error] [pid 12967] [client ::1:41077] End of script output before headers: index.py
これは役立つかもしれません:http://serverfault.com/questions/107952/premature-end-of-script-and-exec-format-error – sebastian
あなたは手でスクリプトを実行できますか?それを実行します? –
CGIとしてのPythonの実行は1990年代です。しかし、本当にこのルートに行きたい場合は、ヘッダーの後に空白行( '\ n')がなければならないことに注意してください。 – e4c5