malformed header from script index.py Fehlerhafter Header
Ich möchte Python-Code auf einem Apache2-Server (Ubuntu 14.04) ausführen. Ich bin diesen Schritten gefolgt und erhalte den Fehler:
Schritt 1
Konfiguration 1: Ich habe ein Verzeichnis und eine Datei unter @ erstel
/var/www/cgi-bin
Configuration 2: Ich habe /etc/apache2/sites-available/000-default.conf@ bearbeite
Alias /cgi-bin /var/www/cgi-bin
<Directory "/var/www/cgi-bin">
Options Indexes FollowSymLinks ExecCGI
AddHandler cgi-script .cgi .py
Allow from all
</Directory>
<Directory /var/www/cgi-bin>
Options All
</Directory>
Schritt 2
und mein Python-Skript lautet: index.py
#!/usr/bin/env python
import cgi;
import cgitb;cgitb.enable()
print "Content-Type: text/plain\n"
print "<b>Hello python</b>"
Schritt 3
Wenn ich über den Chrome-Browser lief, mit: URL:http: //localhost/cgi-bin/index.p
Schritt 4
Ich erhalte diesen Fehler im Fehlerprotokoll
malformed header from script 'index.py': Bad header: Hello Python