Python and Apache

David Fuess fuess at att.net
Mon Apr 16 14:20:38 EDT 2001


I'm having a heck of a time convincing my Apache web server
that it's ok to run Python CGI scripts. The test script
"hello" does indeed exist in the proper directory and runs fine
under Python from the command line. But when I try to run it
from a browser as in http://<server>/cgi-bin/hello it fails.
Any ideas?

Thanks,
Dave

Kernel:
Red Hat Linux release 6.2 (Zoot)
Kernel 2.2.14-5.0 on an i586

Apache:
Apache/1.3.12 (Unix)  (Red Hat/Linux)

Python:
BeOpen 2.0.1

----- BEGIN httpd.conf SNIPIT -----
ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"

<Directory "/home/httpd/cgi-bin">
    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>
----- END http.conf SNIPIT -----

----- BEGIN SCRIPT SNIPIT ---
#!/usr/local/bin/python

import os, sys, cgi, string, time

print "Content-type: text/html" # identify response as HTML
print # end of headers

print "<html><head>"
print "<title>About Me</title>"
----- END SCRIPT SNIPIT ---

----- BEGIN error_log SNIPIT ---
[Mon Apr 16 11:02:42 2001] [error] (2)No such file or directory: exec
of /home/httpd/cgi-bin/hello failed
[Mon Apr 16 11:02:42 2001] [error] [client xxx] Premature end of
script headers: /home/httpd/cgi-bin/hello
----- END error_log SNIPIT ---




More information about the Python-list mailing list