问题描述

源码编译安装的 php, 在启动 php-fpm 时无法启动,同时系统日志报:

1
2
3
4
5
Dec 27 11:09:00 vm181-ubuntu22 php-fpm[567553]: [27-Dec-2023 11:09:00] ERROR: failed to open error_log (/usr/local/php/var/log/php-fpm.log): Read-only file system (30)
Dec 27 11:09:00 vm181-ubuntu22 php-fpm[567553]: [27-Dec-2023 11:09:00] ERROR: failed to post process the configuration
Dec 27 11:09:00 vm181-ubuntu22 php-fpm[567553]: [27-Dec-2023 11:09:00] ERROR: FPM initialization failed
Dec 27 11:09:00 vm181-ubuntu22 php-fpm[567553]: profiling:/usr/local/src/php-7.4.30/sapi/fpm/fpm/.libs/fpm_systemd.gcda:Cannot open
Dec 27 11:09:00 vm181-ubuntu22 php-fpm[567553]: profiling:/usr/local/src/php-7.4.30/sapi/fpm/fpm/.libs/fpm_trace_ptrace.gcda:Cannot open

解决方法

编辑 php-fpm 启动脚本文件 /lib/systemd/system/php-fpms.service ,将 ProtectSystem=full 修改为 ProtectSystem=false 即可!