在 cp /usr/src/php-X.X.X/sapi/fpm/php-fpm.service /etc/systemd/system/之后
重载系统服务后
systemctl daemon-reload
提示报错
ERROR: failed to open error_log (/usr/local/php/var/log/php-fpm.log): Read-only file system
解决方法
将原 php-fpm.service 移至新的目录内 修改文件
移动 php-fpm.service 到新的目录里面
mv /etc/systemd/system/php-fpm.service /usr/lib/systemd/system
cd /usr/lib/systemd/system
nano /etc/systemd/system/php-fpm.service
-----------------------------------------------------------------
注释
将 ProtectSystem=full 修改成 允许全盘访问
# Mounts the /usr, /boot, and /etc directories read-only for processes invoked by this unit.
#以只读方式将/ usr,/ boot和/ etc目录挂载为此单元调用的进程。
-----------------------------------------------------------------
ProtectSystem=false
退出 保存
启动php-fpm
systemctl daemon-reload
systemctl stop php-fpm
systemctl start php-fpm
systemctl status php-fpm