2013-07-15 38 views
1

我是一名python開發人員,但是當我將我的文件放入cgi-bin目錄 並通過我的瀏覽器運行時,它顯示500內部服務器錯誤。Python CGI顯示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. Filelocation:http://mywebsite.com/cgi-bin/test.py

.htaccess文件:

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

請給些建議!

+0

你的error.log是什麼意思? –

+0

在error_log中沒有輸入這個錯誤 – Alisha

回答

3

假設服務器設置正常,最可能的問題是忘記在複製到cgi-bin目錄後將python文件設置爲可執行文件。

+0

我做了chmod + x test.py但沒有結果。 – Alisha

+0

嘗試chmod a + rx test.py –

+0

或嘗試設置chmod 755。 – mchfrnc