Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.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_wsgi无法运行mkfifo?_Python_Mod Wsgi - Fatal编程技术网

Python Mod_wsgi无法运行mkfifo?

Python Mod_wsgi无法运行mkfifo?,python,mod-wsgi,Python,Mod Wsgi,我试图在RHEL6上运行mod_wsgi应用程序,但无论我如何尝试,我似乎都无法实现FIFO。我想这可能是权限问题,但我想不出来 以下是httpd配置的相关部分: WSGIDaemonProcess loris user=loris group=loris processes=10 threads=15 maximum-requests=10000 WSGISocketPrefix /var/run/wsgi WSGIProcessGroup loris <Directory /var/

我试图在RHEL6上运行mod_wsgi应用程序,但无论我如何尝试,我似乎都无法实现FIFO。我想这可能是权限问题,但我想不出来

以下是httpd配置的相关部分:

WSGIDaemonProcess loris user=loris group=loris processes=10 threads=15 maximum-requests=10000
WSGISocketPrefix /var/run/wsgi
WSGIProcessGroup loris

<Directory /var/www/loris>
    Order allow,deny
    Allow from all
</Directory>

显然,用户有权限写入目录,但看起来mkfifo尤其是一个问题,因为/bin/touch工作正常。我可以自己制作fifo,所以文件系统支持它们。我还可以以用户loris的身份在python shell中使用shell out和os.mkfifo两种方式生成FIFO。我认为这与mod_wsgi和权限有关,但我想不出还有什么可以尝试的。

你能提供ls-l/var/www/loris/var/www/loris/binfifo的输出吗?文件/var/www/loris/binfifo不存在,这就是问题所在!。这个目录是由loris拥有的:loris。我仍然非常希望看到上面命令的输出;别担心,如果您要求ls列出一个不存在的文件,它不会崩溃。实际上,请将其设为ls-ld/var/www/loris/var/www/loris/binfifols:cannotaccess/var/www/loris/bininfo:No-this-file或directory,然后设置为drwxr-xr-x。loris loris 4096 Jan 15 21:19/var/www/loris无法在标记中显示换行符。是否可以尝试子流程。检查WSGI中的输出“id”?出于某种原因,它可能以其他用户身份运行。
import getpass
import os
import subprocess

def application(environ, start_response):
    status = '200 OK'
    response_headers = [('Content-type', 'text/plain')]

    path = '/var/www/loris'

    c = ''
    c += 'user: %s\n' % getpass.getuser() # prints 'loris', as expected

    # try opening a file; works fine
    f = open('%s/open.txt' % path, 'w')
    f.write('ok\n')
    f.close()
    c += 'we can write a file\n'

    # try 'touching' a file; works fine
    call = '/bin/touch %s/touch.txt' % path
    s = subprocess.check_call(call, shell=True)
    c += '/bin/touch status = %s' % s    # prints 0, as expected

    # try shelling out to mkfifo; doesn't work
    # Error msg: '/usr/bin/mkfifo: cannot create fifo `/var/www/loris/binfifo':
    #   Permission denied'
    call = '/usr/bin/mkfifo %s/binfifo' % path
    s = subprocess.check_call(call, shell=True)
    # throws a 500 error

    # try os.mkfifo(); doesn't work either
    fifo_path = '%s/os_fifo' % path
    os.mkfifo(fifo_path)
    s = subprocess.check_call(call, shell=True)
    # again, 'OSError: [Errno 13] Permission denied'

    start_response(status, response_headers)
    return c