1、关闭当前的php环境,运行命令,下面二选一,根据你自己情况来选
bash
service php-fpm stop
或
systemctl stop php-fpm
2、运行命令vim /etc/systemd/system/phpfpm.service,输入以下代码,注意php-fpm路径需要改成自己的路径
bash
[Unit]
Description=phpfpm
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.d/init.d/php-fpm start
ExecReload=/etc/rc.d/init.d/php-fpm restart
ExecStop=/etc/rc.d/init.d/php-fpm stop
[Install]
WantedBy=multi-user.target
3、重载守护程序
bash
sudo systemctl daemon-reload
4、设置开机自动,执行以下
bash
systemctl enable phpfpm.service
5、执行启动
bash
systemctl start phpfpm.service
6、查看状态
bash
systemctl start phpfpm.service
7、关闭开机自启,执行以下
bash
systemctl disable phpfpm.service