php-fpm - OSX PHP56 nginx 服务器 权限问题,导致php链接500错误

WBOY
发布: 2016-06-06 20:22:58
原创
23376 人浏览过

<code>[07-Dec-2015 17:07:08] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[07-Dec-2015 17:07:08] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root</code>
登录后复制
登录后复制

查看php-fpm日志发现以上提示,尝试将php-fpmusergroup修改成当前用户所匹配的,错误依旧。

通过lsof -Pni4 | grep LISTEN | grep php看到php-fpm确实是以当前用户而非root用户运行。

<code>php-fpm   51546 joshua    7u  IPv4 0xef21d7f98be9663      0t0  TCP 127.0.0.1:9056 (LISTEN)
php-fpm   51551 joshua    0u  IPv4 0xef21d7f98be9663      0t0  TCP 127.0.0.1:9056 (LISTEN)
php-fpm   51552 joshua    0u  IPv4 0xef21d7f98be9663      0t0  TCP 127.0.0.1:9056 (LISTEN)
php-fpm   51553 joshua    0u  IPv4 0xef21d7f98be9663      0t0  TCP 127.0.0.1:9056 (LISTEN)</code>
登录后复制
登录后复制

回复内容:

<code>[07-Dec-2015 17:07:08] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[07-Dec-2015 17:07:08] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root</code>
登录后复制
登录后复制

查看php-fpm日志发现以上提示,尝试将php-fpmusergroup修改成当前用户所匹配的,错误依旧。

通过lsof -Pni4 | grep LISTEN | grep php看到php-fpm确实是以当前用户而非root用户运行。

<code>php-fpm   51546 joshua    7u  IPv4 0xef21d7f98be9663      0t0  TCP 127.0.0.1:9056 (LISTEN)
php-fpm   51551 joshua    0u  IPv4 0xef21d7f98be9663      0t0  TCP 127.0.0.1:9056 (LISTEN)
php-fpm   51552 joshua    0u  IPv4 0xef21d7f98be9663      0t0  TCP 127.0.0.1:9056 (LISTEN)
php-fpm   51553 joshua    0u  IPv4 0xef21d7f98be9663      0t0  TCP 127.0.0.1:9056 (LISTEN)</code>
登录后复制
登录后复制

改fpm配置让fpm以你想要用户运行,

sudo vim /etc/php-fpm.d/www.conf

<code>; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
;                 mode is set to 0660
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0660

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache</code>
登录后复制
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板