[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Python and Apache



	I am a newbie to Python and am trying to run Python through Apache.  I keep getting 500 server errors from Apache.  Does anyone have some tips on getting this combination working together.  I notice in Apache2 there is a separate config file for Python.  I have tried multiple combinations.  I have also found a couple web sites with tutorials.  Here is some if the errors from my apache log file:

[Wed Apr 30 14:28:09 2003] [error] [client 127.0.0.1] Premature end of script headers: test.cgi
[Wed Apr 30 14:28:15 2003] [error] [client 127.0.0.1] Premature end of script headers: mptest.cgi
[Wed Apr 30 14:29:06 2003] [error] [client 127.0.0.1] Premature end of script headers: test.cgi
[Wed Apr 30 14:29:06 2003] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Apr 30 14:29:06 2003] [error] [client 127.0.0.1]   File "/var/www/cgi-bin/test.cgi", line 2, in ?
[Wed Apr 30 14:29:06 2003] [error] [client 127.0.0.1]     from mod_python import apache
[Wed Apr 30 14:29:06 2003] [error] [client 127.0.0.1]   File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 66, in ?
[Wed Apr 30 14:29:06 2003] [error] [client 127.0.0.1]     import _apache
[Wed Apr 30 14:29:06 2003] [error] [client 127.0.0.1] ImportError: No module named _apache
[Wed Apr 30 14:29:09 2003] [error] [client 127.0.0.1] Premature end of script headers: test.cgi
[Wed Apr 30 14:29:09 2003] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Apr 30 14:29:09 2003] [error] [client 127.0.0.1]   File "/var/www/cgi-bin/test.cgi", line 2, in ?
[Wed Apr 30 14:29:09 2003] [error] [client 127.0.0.1]     from mod_python import apache
[Wed Apr 30 14:29:09 2003] [error] [client 127.0.0.1]   File 

mptest.py:
from mod_python import apache

def handler(req):
    req.send_http_header()
    req.write("Hello World!")
    return apache.OK

test.py:
#!/usr/bin/python
from mod_python import apache

def main():
	print "Content-type: text/html"
	print
	print "<title>test</title>"
	print "hello test"
	
	main()

thanks,
Craig Herring





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]