新增配置文件,根据自己安装的php-fpm路径修改
vim /usr/lib/systemd/system/php-fpm.service
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=simple
PIDFILE=/usr/local/php/var/run/php-fpm.pid
ExecStart=/etc/init.d/php-fpm start --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
ExecRestart=/bin/kill -USR2 $PIDFILE
ExecStop=/bin/kill -SIGINT $PIDFILE
[Install]
WantedBy=multi-user.target
增加开机启动
systemctl enable php-fpm.service
操作命令
# 启动
systemctl start php-fpm.service
# 停止
systemctl stop php-fpm.service
# 重启
systemctl restart php-fpm.service