在用Python编写CGI,但网页提示500错误
apache吧
全部回复
仅看楼主
level 1
tianyahappy 楼主
利用Python编写CGI,Windows配置好Apache, 但是浏览器下:http://localhost/cgi-bin/hello.py, 就出行500错误,在error log内可以看到:是(OS5)拒绝访问错误。 已经试过把文件修改为完全控制,但还是错误依旧,请兄弟姐妹们帮忙指点。
#!C:/python27
# -*- coding: UTF-8 -*-
print "Content-type:text/html"
print # 空行,告诉服务器结束头部
print '<html>'
print '<head>'
print '<meta charset="utf-8">'
print '<title>Hello World - 我的第一个 CGI 程序!</title>'
print '</head>'
print '<body>'
print '<h2>Hello World! 我是来自菜鸟教程的第一CGI程序</h2>'
print '</body>'
print '</html>'
[Sun Apr 15 16:23:23.705800 2018] [cgi:error] [pid 3480:tid 864] (OS 5)拒绝访问。 : [client ::1:49810] couldn't create child process: 720005: hello.py
[Sun Apr 15 16:23:23.705800 2018] [cgi:error] [pid 3480:tid 864] (OS 5)拒绝访问。 : [client ::1:49810] AH01223: couldn't spawn child process: E:/Apache24/cgi-bin/hello.py
2018年04月15日 13点04分 1
level 1
开头那行改为 #!C:/python27/python.exe 试试
2018年04月16日 08点04分 2
有效!
2018年09月16日 14点09分
有效+1 谢谢
2024年06月15日 07点06分
level 1
[cgi:error] [pid 6168:tid 968] (OS 2)系统找不到指定的文件。 : [client ::1:55868] AH01223: couldn't spawn child process: 这样的错误多半是你首行解释器地址没配对
[cgi:error] [pid 6168:tid 960] (OS 5)拒绝访问。 : [client ::1:57171] couldn't create child process: 720005 这样的就是楼上说的问题
2018年09月16日 14点09分 3
level 1
python 文件的首行指定解释器的位置...
比如, 我的python首行是这样的:
#!C:\Program Files\Python\Python310\python.exe
2024年08月02日 08点08分 4
我查了下以前的配置, 还有一行可能也有关系, 忘了具体情况了. AddHandler cgi-script .py
2024年08月02日 08点08分
1