我需要关于如何在apache中运行脚本test.cgi的帮助? 我创建的测试脚本:在apache上运行python脚本(linux和windows)
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# enable debugging
import cgitb
cgitb.enable()
print "Content-Type: text/plain;charset=utf-8"
print
print "Hello World!
当我运行localhost/cgi-bin/test.cgi
它给我的错误。
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80
Python正确安装。 Test.cgi chmod是755
我是linux新手。在wndows它也给我错误。 在Windows上,给了我:
End of script output before headers: python_test.cgi
我使用这个脚本在Windows上:
#!"C:\Python34\python.exe"
# -*- coding: UTF-8 -*-
# enable debugging
import cgitb
cgitb.enable()
print "Content-Type: text/plain;charset=utf-8"
print
print "Hello World!"
任何想法?
你可以在你的'httpd.conf'文件中显示配置吗? – 2014-12-19 10:56:33
在linux是空的,窗口是好的因为Perl脚本工作正常。 我添加了LoadModule cgi_module modules/mod_cgi.so和AddHandler cgi-script .cgi .pl .asp .py – Mirko 2014-12-19 11:37:40