简体   繁体   English

Python CGI引发500内部服务器错误

[英]Python CGI throwing 500 Internal Server Error

Im running a website hosted on HelioHost, I'm a 10th grade student, so I can't exactly afford to pay for hosting. 我正在HelioHost上托管一个网站,我是10年级的学生,所以我完全负担不起托管费用。

I was trying to run a simple CGI Script written in python on the web server: 我试图在Web服务器上运行用python编写的简单CGI脚本:

#!/usr/bin/env python
print "Content-type: text/html\n\n"
print "<h1>Hello World</h1>"

Unfortunately, I got a 500 Internal Server error at http://fpl.heliohost.org/cgi-bin/lel.py 不幸的是,我在http://fpl.heliohost.org/cgi-bin/lel.py收到了500 Internal Server错误。

I tried replacing the shebang line with #!/usr/bin/python , as suggested at http://www.heliohost.org/home/features/languages/python , but I'm still facing the same error. 我尝试使用#!/usr/bin/python替换shebang行,如http://www.heliohost.org/home/features/languages/python上的建议,但我仍然遇到相同的错误。

chmod is 755. Also, I'm able to run this on my PC via Python Command Line, and it works fine on my Apache Web Server on my Raspberry Pi. chmod是755。此外,我还可以通过Python命令行在PC上运行它,并且它在Raspberry Pi上的Apache Web服务器上也可以正常工作。

Any idea what could be causing the problem? 知道是什么原因引起的吗?

I managed to get it working by changing the permissions (chmod) of cgi-bin to 0755 from 0777 . 我设法通过将cgi-bin的权限(chmod)从0777更改为0755使其工作。

The curious part is, why wasn't it working with 0777? 奇怪的是,为什么它不能与0777一起使用? I guess that's for another day...... 我想那是另一天……

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM