在简单的CGI脚本内部服务器错误(500) [英] internal server error (500) in simple cgi script

查看:613
本文介绍了在简单的CGI脚本内部服务器错误(500)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的配置服务器后运行一个简单的CGI脚本。

I am trying to run a simple cgi script after configuring my server.

我的脚本是这样的:

print "Content-type: text/html"
print
print "<html><head><title>CGI</title></head>"
print "<body>"
print "hello cgi"
print "</body>"
print "</html>"

当我去我的脚本网址 http://127.0.0.1/~flybywire/cgi-bin/main.py 我得到:

When I go to my scripts url http://127.0.0.1/~flybywire/cgi-bin/main.py I get:

内部服务器错误

服务器遇到一个内部错误或配置错误,无法完成您的请求。

而在 error.log中我收到以下内容:


[错误](8)Exec的格式错误:的/home/flybywire/www/cgi-bin/main.py'失败EXEC
[错误] [客户端127.0.0.1]脚本头premature月底:main.py

其他信息: 的Apache / 2.2.8(Ubuntu的)DAV / 2 SVN在127.0.0.1端口80 / 1.4.6服务器

推荐答案

您可能需要一个#!的/ usr / bin中/ Python的在你的脚本的顶部告诉Apache来使用Python来执行它。至少,我这样做,它的工作对我来说:-)。

You might need a #!/usr/bin/python at the top of your script to tell Apache to use Python to execute it. At least, I did that and it worked for me :-) .

这篇关于在简单的CGI脚本内部服务器错误(500)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆