linux系统php开机自启动 phpfpm

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
相关推荐
乱蜂朝王24 分钟前
Ubuntu 20.04安装CUDA 11.8
linux·运维·ubuntu
梁洪飞1 小时前
clk学习
linux·arm开发·嵌入式硬件·arm
Lw老王要学习2 小时前
Windows基础篇第一章_01VMware虚拟机安装window10
运维·windows·虚拟机
~光~~2 小时前
【嵌入式linux驱动——点亮led】基于鲁班猫4 rk3588s
linux·点灯·嵌入式linux驱动
yuanmenghao2 小时前
车载Linux 系统问题定位方法论与实战系列 - 车载 Linux 平台问题定位规范
linux·运维·服务器·网络·c++
qq_589568104 小时前
centos6.8镜像源yum install不成功,无法通过镜像源下载的解决方式
linux·运维·centos
weixin_516023074 小时前
linux下fcitx5拼音的安装
linux·运维·服务器
hunter14505 小时前
Linux 进程与计划任务
linux·运维·服务器
shizhenshide5 小时前
社交媒体自动化:批量注册/发帖的验证码难题一站式解决
自动化·php·媒体·验证码·ezcaptcha
楼田莉子5 小时前
Linux学习之磁盘与Ext系列文件
linux·运维·服务器·c语言·学习