我最近重新安装了我的Ubuntu PC(到12.04)&不得不重新设置apache。
local.domain.com指向localhost(虚拟主机)。
http://local.domain.com/script.py?query=string
script.py被chmod'd为755
在我的.htaccess我:错误500执行python脚本
Options +ExecCGI
AddHandler cgi-script .py
但我得到一个500:内部服务器错误。
cat /var/log/apache2/error.domain.com.log什么也没有显示。
如果我在命令行做蟒蛇script.py我得到:
<!-- The above is a description of an error in a Python program, formatted
for a Web browser because the 'cgitb' module was enabled. In case you
are not reading this in a Web browser, here is the original traceback:
Traceback (most recent call last):
File "script.py", line 32, in <module>
queryHash = hashlib.sha224(os.environ['QUERY_STRING']).hexdigest()
File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'QUERY_STRING'
-->
所以我不图什么毛病PY脚本。它曾经工作过。 但由于某种原因,它不在浏览器中执行。 我还能错过什么?
看起来Apache没有将'QUERY_STRING'环境变量设置为请求中查询字符串的值。我不是阿帕奇人,所以我没有其他见解,但也许这些信息对你有用。 – cheeken