在apache上运行python脚本

时间:2014-12-19 20:56:56

标签: python apache

你好我有一个apache脚本:(现在只用于测试)

#!/usr/bin/python

# Import modules for CGI handling 
import cgi, cgitb 

# Create instance of FieldStorage 
form = cgi.FieldStorage() 

# Get data from fields
name = form.getvalue('name')
var  = form.getvalue('var')


print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Hello - Second CGI Program</title>"
print "</head>"
print "<body>"
print "<h2>Hello %s %s</h2>" % (name, var)
print "</body>"
print "</html>"

和index.html:

 <!DOCTYPE html>
<html>

<body>

<form action="/cgi-bin/test.py" method="post">
nazov suboru: <input type="text" name="name">  <br />
premenna: <input type="text" name="var" />

<input type="submit" value="Submit" />
</form>

</body>

</html> 

当我向frm添加内容并单击提交时,它会给我错误.. 测试脚本helloworld工作得很好..任何想法问题在哪里? 我正在使用linux,apache和cgi-mod。

ERROR:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80

0 个答案:

没有答案