Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python &引用;mod_fcgid:从FastCGI服务器读取数据时出错;对于直接运行时工作的简单fcgi脚本_Python_Linux_Apache_Bash_Fastcgi - Fatal编程技术网

Python &引用;mod_fcgid:从FastCGI服务器读取数据时出错;对于直接运行时工作的简单fcgi脚本

Python &引用;mod_fcgid:从FastCGI服务器读取数据时出错;对于直接运行时工作的简单fcgi脚本,python,linux,apache,bash,fastcgi,Python,Linux,Apache,Bash,Fastcgi,我有以下fcgi脚本: #! /usr/bin/python import subprocess, sys, os command=["sudo", "-u", "matt", "/home/matt/cgi-bin/peercoin-abe", str(os.getpid())] subprocess.Popen(command, stdin=sys.stdin).wait() peercoin abe包含: #! /bin/sh PYTHONUNBUFFERED=1 exec python

我有以下fcgi脚本:

#! /usr/bin/python
import subprocess, sys, os
command=["sudo", "-u", "matt", "/home/matt/cgi-bin/peercoin-abe", str(os.getpid())]
subprocess.Popen(command, stdin=sys.stdin).wait()
peercoin abe包含:

#! /bin/sh PYTHONUNBUFFERED=1 exec python /home/matt/peercoin-explorer/Peercoin-Abe/abe.py \
--config /home/matt/abe-peercoin.conf --static-path static/ --watch-pid="$1" >> /home/matt/abe-peercoin.log
但是当我尝试访问它时,我在错误日志中得到错误:

[Fri Aug 22 22:07:08 2014] [warn] [client 149.254.181.200] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Fri Aug 22 22:07:08 2014] [error] [client 149.254.181.200] Premature end of script headers: peercoin-abe.fcgi
我设置了
FcgidIOTimeout 40
FcgidBusyTimeout 3600
。peercoin-abe.fcgi是可执行文件,由root所有。peercoin abe是可执行文件,由matt所有


所以您希望输出到abe-peercoin.log,但没有。运行peercoin-abe.fcgi会直接导致输出到abe-peercoin.log,正如预期的那样。

fcgi对此不是很明确,但问题是由于web用户的权限无法作为matt执行。有必要将其添加到sudoers文件中:

www-data ALL=(matt) NOPASSWD: /home/matt/cgi-bin/peercoin-abe