[英]Unable to start php-fpm - “cannot get uid for user 'apache'”
On a fresh AWS Linux HVM box, I ran the commands:在一个全新的 AWS Linux HVM 机器上,我运行了以下命令:
sudo yum update
sudo yum install git nginx php-fpm
I then tried to sudo service start php-fpm
, but got the error:然后我尝试
sudo service start php-fpm
,但得到了错误:
Starting php-fpm: [10-Sep-2014 20:52:39] ERROR: [pool www] cannot get uid for user 'apache'
[10-Sep-2014 20:52:39] ERROR: FPM initialization failed
Where am I going wrong and where is the apache user coming from?我哪里出错了,apache 用户来自哪里?
The apache
user comes from php-fpm.conf
file. apache
用户来自php-fpm.conf
文件。 It does not matter that you run it as root, the service will start as the user which is configured in this file.以 root 身份运行它并不重要,该服务将以在此文件中配置的用户身份启动。
Find your php-fpm.conf
file.找到您的
php-fpm.conf
文件。 It should be somwhere in /etc
.它应该在
/etc
某个地方。 Edit it and change lines编辑它并更改行
user = apache
group = apache
to到
user = www-data
group = www-data
I'm assuming your default nginx configuration also uses the www-data
user.我假设您的默认 nginx 配置也使用
www-data
用户。
For a docker OpenShift no root way, prepare groups in build对于 docker OpenShift 无根方式,在构建中准备组
vim /etc/groups
eg nobody:x:999:
例如
nobody:x:999:
it's after some update in php-fpm这是在php-fpm 中的一些更新之后
Just adding for the latest ubuntu 18.04, it was a different user(magento) and was running on PHP 7.2.只是为最新的 ubuntu 18.04 添加,它是一个不同的用户(magento)并且在 PHP 7.2 上运行。
Feb 12 14:33:23 same-cloud systemd[1]: Starting The PHP 7.2 FastCGI Process Manager...
Feb 12 14:33:23 same-cloud php-fpm7.2[8328]: [12-Feb-2020 14:33:23] ERROR: [pool magento] cannot get uid for user 'magento'
Feb 12 14:33:23 same-cloud php-fpm7.2[8328]: [12-Feb-2020 14:33:23] ERROR: FPM initialization failed
Feb 12 14:33:23 same-cloud systemd[1]: php7.2-fpm.service: Main process exited, code=exited, status=78/n/a
Feb 12 14:33:23 same-cloud systemd[1]: php7.2-fpm.service: Failed with result 'exit-code'.
Feb 12 14:33:23 same-cloud systemd[1]: Failed to start The PHP 7.2 FastCGI Process Manager.
From terminal,从终端,
sudo nano /etc/php/7.2/fpm/pool.d/magento.conf
I changed the contents as follows in the magento.conf
file:我更改了
magento.conf
文件中的内容如下:
[magento]
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
listen = /var/run/php/php7.2-fpm-magento.sock
In order to give effect, run the following commands:为了生效,请运行以下命令:
sudo systectl restart apache2
To see the status查看状态
systemctl status php7.2-fpm.service
Additional commands to enable fpm启用 fpm 的其他命令
a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.