![PHP 7 FPM checkconf 抛出无效用户:“www-data:www-data”,但我没有使用 www-data 用户](https://linux22.com/image/727933/PHP%207%20FPM%20checkconf%20%E6%8A%9B%E5%87%BA%E6%97%A0%E6%95%88%E7%94%A8%E6%88%B7%EF%BC%9A%E2%80%9Cwww-data%EF%BC%9Awww-data%E2%80%9D%EF%BC%8C%E4%BD%86%E6%88%91%E6%B2%A1%E6%9C%89%E4%BD%BF%E7%94%A8%20www-data%20%E7%94%A8%E6%88%B7.png)
我正在使用其他用户来提供我的 Web 服务。打破惯例。
我没有www-data
设置任何 php 配置文件:
$ grep -rnw /etc -e 'www-data'
$
但我仍然收到此错误:
$ journalctl -u php7.0-fpm
php7.0-fpm-checkconf[19642]: chown: invalid user: ‘www-data:www-data’
systemd[1]: php7.0-fpm.service: Control process exited, code=exited status=1
systemd[1]: Failed to start The PHP 7.0 FastCGI Process Manager.
systemd[1]: php7.0-fpm.service: Unit entered failed state.
systemd[1]: php7.0-fpm.service: Failed with result 'exit-code'.
答案1
我通过首先替换www-data
来修复此问题/usr/lib/tmpfiles.d/php7.0-fpm.conf
,它看起来像这样:
#Type Path Mode UID GID Age Argument
d /run/php 0755 www-data www-data - -
然后我收到另一个错误:
systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
php-fpm7.0[]: [] ERROR: failed to open error_log (/var/log/php7.0-fpm.log): Permission denied (13)
php-fpm7.0[]: [] ERROR: failed to post process the configuration
php-fpm7.0[]: [] ERROR: FPM initialization failed
systemd[1]: php7.0-fpm.service: Main process exited, code=exited, status=78/n/a
systemd[1]: Failed to start The PHP 7.0 FastCGI Process Manager.
systemd[1]: php7.0-fpm.service: Unit entered failed state.
systemd[1]: php7.0-fpm.service: Failed with result 'exit-code'.
我通过将日志文件的组和权限更改为我的网络服务器用户来修复此问题:
$ sudo chgrp mywebserveruser /var/log/php7.0-fpm.log
$ sudo chmod g+rw /var/log/php7.0-fpm.log
最后重新启动 fpm:
$ sudo systemctl reload-or-restart