【问题标题】:Python CGI Showing 500 internal server errorPython CGI 显示 500 内部服务器错误
【发布时间】:2013-07-15 19:58:28
【问题描述】:

我是一名 python 开发人员,但是当我将文件放入 cgi-bin 目录时 并通过我的浏览器运行它显示 500 内部服务器错误。

#!/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!"

这是我的 test.py。 文件位置:http://mywebsite.com/cgi-bin/test.py

.htaccess 文件:

 RewriteEngine on
 Options +ExecCGI AddHandler cgi-script cgi py
 Options +ExecCGI SetHandler cgi-script

请给点建议!

【问题讨论】:

  • 你的 error.log 是怎么说的?
  • error_log中没有这个错误的条目

标签: python .htaccess cgi


【解决方案1】:

假设服务器设置正常,最可能的问题是在复制到 cgi-bin 目录后忘记将 python 文件设置为可执行。

【讨论】:

  • 我做了 chmod +x test.py 但没有结果。
  • 试试 chmod a+rx test.py
  • 或者尝试设置 chmod 755。
猜你喜欢
  • 2011-10-09
  • 2016-04-24
  • 2016-12-22
  • 1970-01-01
  • 1970-01-01
  • 2013-11-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多