All Python CGI scripts on DreamHost must:
- end in "
.py" (NOTE: "
.cgi, .fcgi" works as well).
#!/usr/bin/pythonin the very first line of the file (NOTE:
#!/usr/bin/env python2.xwill work as well).
- be marked as executable:
- use UNIX style newlines, not Windows.
- If you want to view printed output from your Python code, you must
print "Content-type: text/html\n\n"as the first line of output.
- If you don't want .py files to be executed by Apache add "RemoveHandler .py" command to your .htaccess file.
- Additionally, on DreamHost, all Python CGI scripts AND their immediate parent directory must have their Unix user and Unix group left set to your domain's Unix user AND that user's DEFAULT Unix group (otherwise you will get an internal server error from Apache's suexec).