[英]Changing group of php-fpm
I want to execute php-fpm (7.2) with another group while staying in the original groups.我想在留在原始组中的同时与另一个组执行 php-fpm (7.2)。
Currently php-fpm runs with www-data as user and group.目前 php-fpm 以www-data作为用户和组运行。 I've created a new group ( testgrp ) and added the user www-data to the group.我创建了一个新组( testgrp )并将用户www-data添加到该组。
www-data has gid: 33 www-data有 gid: 33
testgrp has gid: 144 testgrp有 gid: 144
For a spawned PHP-process, /proc/PID/status
gives me:对于衍生的 PHP 进程, /proc/PID/status
给了我:
Uid: 33 33 33 33
Gid: 33 33 33 33
Groups: 33 144
which shows that php runs with www-data as user and main group, but is also in testgrp .这表明 php 以www-data作为用户和主组运行,但也在testgrp中。
When I set group = testgrp
in /etc/php/7.2/fpm/pool.d/www.conf
, I get:当我在/etc/php/7.2/fpm/pool.d/www.conf
中设置group = testgrp
时,我得到:
Uid: 33 33 33 33
Gid: 144 144 144 144
Groups: 144
so php runs with testgrp as only group.所以 php 以testgrp作为唯一组运行。
Is there a way to change the executing group without loosing the membership of www-data ?有没有办法在不失去www-data成员资格的情况下更改执行组?
So after looking into the source-code of php-fpm, I found the solution:因此,在查看了 php-fpm 的源代码后,我找到了解决方案:
I had to add the user www-data to the www-data group (again).我不得不将用户www-data添加到www-data组(再次)。
Even though www-data is the primary group of user www-data , it has to be assigned in /etc/group
, because php-fpm uses the groups from /etc/group
+ the provided group while ignoring the primary group.即使www-data是用户www-data的主要组,它也必须在/etc/group
中分配,因为 php-fpm 使用来自/etc/group
+ 提供的组的组,而忽略主要组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.