【发布时间】:2015-02-18 06:48:18
【问题描述】:
我需要有关如何在 apache 中运行脚本 test.cgi 的帮助? 我创建了测试脚本:
#!/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, webmaster@localhost 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文件中显示配置? -
在 linux 中是空的,windows 是好的,因为 perl 脚本工作正常。我添加了 LoadModule cgi_module modules/mod_cgi.so 和 AddHandler cgi-script .cgi .pl .asp .py
标签: python linux windows apache