我正在使用其他用户来提供我的 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