• 执行 systemctl start php-fpm.service
  • 提示错误 Failed to start php-fpm.service: Unit not found.
  • 原因是系统中没有配置 php-fpm.service 文件
  • 通过find / -name nginx.service 找到nginx.service 配置文件路径
  • 然后去到那个路径 新建一个php-fpm.service文件 保存下面这一段内容,php-fpm路径根据自己的实际情况修改
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm(你的php-fpm路径) --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf(你的php-fpm配置文件路径)
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID

[Install]
WantedBy=multi-user.target