flybywire flybywire - 4 months ago 6
Python Question

internal server error (500) in simple cgi script

I am trying to run a simple cgi script after configuring my server.

My script looks like this:

print "Content-type: text/html"
print "<html><head><title>CGI</title></head>"
print "<body>"
print "hello cgi"
print "</body>"
print "</html>"

When I go to my scripts url
I get:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

And in
I get the following:

[error] (8)Exec format error: exec of '/home/flybywire/www/cgi-bin/' failed
[error] [client] Premature end of script headers:

Other info:
Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.4.6 Server at Port 80


You might need a #!/usr/bin/python at the top of your script to tell Apache to use Python to execute it. At least, I did that and it worked for me :-) .