拷贝php-fpm脚本至/etc/init.d目录(文件在php解压目录)

cp /usr/local/src/php-7.2./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

3.设置权限并启动php-fpm:

chmod 755 /etc/init.d/php-fpm

/etc/init.d/php-fpm start

chkconfig –add php-fpm

最后,给出php-fpm以服务的方式启动、停止和重启:

service php-fpm start

service php-fpm stop

service php-fpm reload

PHP-FPM 自启动配置服务:

vim /etc/rc.d/rc.local

查看开机启动的所有服务

chkconfig --list

第二种:比较好用

将php-fpm加入启动服务

cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service

写入以下内容(路径改成自己的)

[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/php/sbin/php-fpm
PrivateTmp=true
[Install]
WantedBy=multi-user.target

Description:描述服务
After:描述服务类别
[Service]服务运行参数的设置
Type=forking是后台运行的形式
ExecStart为服务的具体运行命令
ExecReload为重启命令
ExecStop为停止命令
PrivateTmp=True表示给服务分配独立的临时空间
注意:[Service]的启动、重启、停止命令全部要求使用绝对路径
[Install]运行级别下服务安装的相关设置,可设置为多用户,即系统运行级别为3

设置开机启动

systemctl enable php-fpm.service

centos7 php-fpm 开机启动的更多相关文章

  1. 【centos7】添加开机启动服务/脚本

    一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...

  2. centos7之添加开机启动服务/脚本

    一.添加开机启动脚本 #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to ...

  3. centos7如何添加开机启动服务/脚本

    一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...

  4. centos7如何添加开机启动项?

    centos7提供开启服务启动的方式: 1.系统服务管理命令,如果是通过yum安装的软件,开机启动脚本,已经自动创建好了,直接执行如下命令 nginx.service后缀可以省略 systemctl ...

  5. centos7 设置 查看 开机 启动项

    1.查看开机自启项centos7自启项已不用chkconfig改为:systemctl list-unit-files左边是服务名称,右边是状态,enabled是开机启动,disabled是开机不启动 ...

  6. centos7 安装redis 开机启动

    redis 下载 https://redis.io/download wget http://download.redis.io/releases/redis-3.2.6.tar.gz 解压缩 .ta ...

  7. Centos7.x:开机启动服务的配置和管理

    一.开机启动服务的配置 1.创建服务配置(权限754) vim /usr/lib/systemd/system/nginx.service 文件内容解释 [Unit]:服务的说明Description ...

  8. CentOS7.x 配置开机启动项目

    Centos6.x 下版本主要通过service控制启动与关闭,通过chkconfig来设置开机启动项,但是Centos 7.x 版本采用已经Systemd来控制启动与关闭,Systemd 是 Lin ...

  9. Centos7 设置Mongodb开机启动-自定义服务

    (1).在/lib/systemd/system/目录下新建mongodb.service文件,内容如下 [Unit] Description=mongodb After=network.target ...

  10. centos7 nginx 加入开机启动

    设置nginx开机启动 vi /etc/rc.d/init.d/nginx  #编辑启动文件添加下面内容 ############################################### ...

随机推荐

  1. var $this = $(this)

    jQuery: What’s the Difference Between $(this), $this, and this? What about $this? $this is a little ...

  2. CEF3编译

    要使用CEF3首先就要编译 下载网址为http://opensource.spotify.com/cefbuilds/index.html#windows64_builds 如果下载不动 可以用我上传 ...

  3. SpringBoot上传文件临时失效问题

    线上的系统中不能上传文件了,出现如下错误: org.springframework.web.multipart.MultipartException: Could not parse multipar ...

  4. centos7.7下docker与k8s安装(DevOps三)

    1.系统配置 centos7.7 docker 1.13.1 centos7下安装docker:https://www.cnblogs.com/pu20065226/p/10536744.html 2 ...

  5. Solr安装并导入mysql数据

    参考博客:https://blog.csdn.net/u013160017/article/details/81037279 下载地址:https://lucene.apache.org/solr/m ...

  6. flutter ListView嵌套高度问题

    ListView嵌套时高度无法自适应,需要设置高度才可以显示,设置以下属性可以解决上述问题 shrinkWrap: true, physics: NeverScrollableScrollPhysic ...

  7. jqGrid整理笔记

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  8. Python基本语法_控制流语句_if/while/for

    目录 目录 前言 软件环境 If 语句 While循环 break continue for 循环 遍历String 遍历Tuple 遍历List 遍历Dictionary 最后 前言 控制流语句用于 ...

  9. Selenium 2自动化测试实战3(函数、类和方法)

    一.函数.类和方法1.函数在python中通过def关键字来定义函数 创建一个add()函数,此函数接收两个参数a,b,通过print()打印a+b的结果.调用add()函数,并且上传两个参数3,5给 ...

  10. Docker 资源汇总

    Docker 资源汇总 Docker官方英文资源 Docker官网:http://www.docker.com Docker Windows 入门:https://docs.docker.com/do ...