首先确保php-fpm正常安装,运行命令php-fpm -t输出查看:

##确定php-fpm配置正常
[root@iz2vcf47jzvf8dxrapolf7z php7.3.10]# /usr/local/php7.3.10/sbin/php-fpm -t
[-Oct-::] NOTICE: configuration file /usr/local/php7.3.10/etc/php-fpm.conf test is successful
##启动php-fpm
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# ps -ef|grep php
root 1621 1603 0 09:31 pts/0 00:00:00 grep --color=auto php
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# /usr/local/php7.3.10/sbin/php-fpm
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# ps -ef|grep php|grep -v 'grep'
root 1626 1 0 09:32 ? 00:00:00 php-fpm: master process (/usr/local/php7.3.10/etc/php-fpm.conf)
www 1627 1626 0 09:32 ? 00:00:00 php-fpm: pool www
www 1628 1626 0 09:32 ? 00:00:00 php-fpm: pool www ##重启php-fpm(进程ID已改变)
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# kill -SIGUSR2 `cat /usr/local/php7.3.10/var/run/php-fpm.pid`
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# ps -ef|grep php|grep -v 'grep'
root 1651 1 0 09:36 ? 00:00:00 php-fpm: master process (/usr/local/php7.3.10/etc/php-fpm.conf)
www 1652 1651 0 09:36 ? 00:00:00 php-fpm: pool www
www 1653 1651 0 09:36 ? 00:00:00 php-fpm: pool www ##关闭php-fpm进程
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# kill -SIGINT `cat /usr/local/php7.3.10/var/run/php-fpm.pid` && ps -ef|grep php|grep -v 'grep'
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# ps -ef|grep fpm
root 1682 1603 0 09:41 pts/0 00:00:00 grep --color=auto fpm

可以把上面命令配置到~/.bashrc文件或/etc/bashrc文件,以快捷方式执行命令。(注意cat两端特殊字符是`不是单引号')

上面SIGUASR2和SIGINT是linux信号常量,而信号是进程在运行过程中,由自身产生或由进程外部发过来的消息(事件)。
      信号是硬件中断的软件模拟(软中断)。每个信号用一个整型常量宏表示,以SIG开头,比如SIGCHLD( 子进程结束向父进程发送的一个信号 )、SIGINT(Ctrl+c)等,它们在系统头文件<signal.h>中定义,也可以通过在shell下键入kill –l查看信号列表,或者键入man 7 signal查看更详细的说明。
      信号是系统响应某些条件而产生的一个事件,接收到该信的进程做出相应的处理。通常信是由错误产生的,如段错误(SIGSEGV)。 但信还可以作为进程间通信的一种方式,由一个进程发送给另一个进程。

另外有种更便捷友好地操作方式,这里用的是centos7,可以使用systemctl

[root@izj6c0ct64t9oyhoeow593z php7.3.10]# vim /usr/lib/systemd/system/php-fpm.service
Description=php-fpm
After=syslog.target network.target
[Service]
Type=forking
PIDFile=/usr/local/php7.3.10/var/run/php-fpm.pid
ExecStart=/usr/local/php7.3.10/sbin/php-fpm
ExecReload=/bin/kill -SIGUSR2 MAINPID
ExecStop=/bin/kill −SIGINT MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
##让服务可用配置
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# systemctl enable php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
##重载system服务配置,使新增的php-pfm配置生效
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# systemctl daemon-reload
##重启fpm报错
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# systemctl reload php-fpm
Job for php-fpm.service invalid.
##查看错误原因,php-fpm还没启动
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# systemctl status php-fpm
● php-fpm.service - php-fpm
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: inactive (dead)
10月 07 10:32:02 izj6c0ct64t9oyhoeow593z systemd[1]: Unit php-fpm.service cannot be reloaded because it is inactive.
##启动,没有提示(一般linux下没有输出就是正常的,就是好消息)
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# systemctl start php-fpm
[root@izj6c0ct64t9oyhoeow593z php7.3.10]#

信号定义在/usr/include/asm/signal.h文件中,以 SIG 作为开头,也可用 kill -l 命令查看,详细信息参见 man 7 signal

[root@izj6c0ct64t9oyhoeow593z php7.3.10]# kill -l
) SIGHUP ) SIGINT ) SIGQUIT ) SIGILL ) SIGTRAP
) SIGABRT ) SIGBUS ) SIGFPE ) SIGKILL ) SIGUSR1
) SIGSEGV ) SIGUSR2 ) SIGPIPE ) SIGALRM ) SIGTERM
) SIGSTKFLT ) SIGCHLD ) SIGCONT ) SIGSTOP ) SIGTSTP
) SIGTTIN ) SIGTTOU ) SIGURG ) SIGXCPU ) SIGXFSZ
) SIGVTALRM ) SIGPROF ) SIGWINCH ) SIGIO ) SIGPWR
) SIGSYS ) SIGRTMIN ) SIGRTMIN+ ) SIGRTMIN+ ) SIGRTMIN+
) SIGRTMIN+ ) SIGRTMIN+ ) SIGRTMIN+ ) SIGRTMIN+ ) SIGRTMIN+
) SIGRTMIN+ ) SIGRTMIN+ ) SIGRTMIN+ ) SIGRTMIN+ ) SIGRTMIN+
) SIGRTMIN+ ) SIGRTMIN+ ) SIGRTMAX- ) SIGRTMAX- ) SIGRTMAX-
) SIGRTMAX- ) SIGRTMAX- ) SIGRTMAX- ) SIGRTMAX- ) SIGRTMAX-
) SIGRTMAX- ) SIGRTMAX- ) SIGRTMAX- ) SIGRTMAX- ) SIGRTMAX-
) SIGRTMAX- ) SIGRTMAX
[root@izj6c0ct64t9oyhoeow593z php7.3.10]# cat /usr/include/asm/signal.h
#ifndef _ASM_X86_SIGNAL_H
#define _ASM_X86_SIGNAL_H #ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/time.h> /* Avoid too many header ordering problems. */
struct siginfo; /* Here we must cater to libcs that poke about in kernel headers. */ #define NSIG 32
typedef unsigned long sigset_t; #endif /* __ASSEMBLY__ */ #define SIGHUP 1
#define SIGINT 2
#define SIGQUIT 3
#define SIGILL 4
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT 6
#define SIGBUS 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGUSR1 10
#define SIGSEGV 11
#define SIGUSR2 12
#define SIGPIPE 13
#define SIGALRM 14
#define SIGTERM 15
#define SIGSTKFLT 16
#define SIGCHLD 17
#define SIGCONT 18
#define SIGSTOP 19
#define SIGTSTP 20
#define SIGTTIN 21
#define SIGTTOU 22
#define SIGURG 23
#define SIGXCPU 24
#define SIGXFSZ 25
#define SIGVTALRM 26
#define SIGPROF 27
#define SIGWINCH 28
#define SIGIO 29
#define SIGPOLL SIGIO
/*
#define SIGLOST 29
*/
#define SIGPWR 30
#define SIGSYS 31
#define SIGUNUSED 31 /* These should not be considered constants from userland. */
#define SIGRTMIN 32
#define SIGRTMAX _NSIG /*
* SA_FLAGS values:
*
* SA_ONSTACK indicates that a registered stack_t will be used.
* SA_RESTART flag to get restarting signals (which were the default long ago)
* SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
* SA_RESETHAND clears the handler when the signal is delivered.
* SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
* SA_NODEFER prevents the current signal from being masked in the handler.
*
* SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
* Unix names RESETHAND and NODEFER respectively.
*/
#define SA_NOCLDSTOP 0x00000001u
#define SA_NOCLDWAIT 0x00000002u
#define SA_SIGINFO 0x00000004u
#define SA_ONSTACK 0x08000000u
#define SA_RESTART 0x10000000u
#define SA_NODEFER 0x40000000u
#define SA_RESETHAND 0x80000000u #define SA_NOMASK SA_NODEFER
#define SA_ONESHOT SA_RESETHAND #define SA_RESTORER 0x04000000 #define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192 #include <asm-generic/signal-defs.h> #ifndef __ASSEMBLY__ /* Here we must cater to libcs that poke about in kernel headers. */
#ifdef __i386__ struct sigaction {
union {
__sighandler_t _sa_handler;
void (*_sa_sigaction)(int, struct siginfo *, void *);
} _u;
sigset_t sa_mask;
unsigned long sa_flags;
void (*sa_restorer)(void);
}; #define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction #else /* __i386__ */ struct sigaction {
__sighandler_t sa_handler;
unsigned long sa_flags;
__sigrestore_t sa_restorer;
sigset_t sa_mask; /* mask last for extensibility */
}; #endif /* !__i386__ */ typedef struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
} stack_t; #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_SIGNAL_H */

php-fpm启动,重启,退出的更多相关文章

  1. Fpm启动机制及流程分析———详细

    FPM(FastCGI Process Manager)是PHP FastCGI运行模式的一个进程管理器,从它的定义可以看出,FPM的核心功能是进程管理,那么它用来管理什么进程呢?这个问题就需要从Fa ...

  2. CentOS 6.4 php-fpm 添加service 添加平滑启动/重启

    nginx通过FastCGI运行PHP比Apache包含PHP环境有明显的优势,最近有消息称,PHP5.4将很有可能把PHP-FPM补丁包含在内核里,nginx服务器平台上运行PHP将更加轻松,下面我 ...

  3. Nginx和PHP-FPM的启动/重启脚本 [转发]

    Nginx和PHP-FPM的启动/重启脚本 [转发] (2012-07-27 16:07:52) 标签: it 分类: 学习 转载自:http://blog.sina.com.cn/s/blog_53 ...

  4. Android设置Activity启动和退出时的动画

    业务开发时遇到的一个小特技,要求实现Activity启动时自下向上弹出,退出时自上向下退出. 此处不关注启动和退出时其他Activity的动画效果,实现方法有两种: 1.代码方式,通过Activity ...

  5. Android应用启动、退出分析

    http://www.jianshu.com/p/72059201b10a §AMS和应用进程 §应用启动流程 §应用退出流程 §启动.退出消息 AMS和应用进程 应用进程 <- 系统管理 &l ...

  6. nginx启动重启与升级以及检测配置文件

    查看nginx的主进程号 ps -ef|grep nginx 从容停止nginx kill - QUIT nginx主进程号 或者 kill - QUIT nginx的pid文件所在,例如我的 [ro ...

  7. UNIX高级环境编程(8)进程环境(Process Environment)- 进程的启动和退出、内存布局、环境变量列表

    在学习进程控制相关知识之前,我们需要了解一个单进程的运行环境. 本章我们将了解一下的内容: 程序运行时,main函数是如何被调用的: 命令行参数是如何被传入到程序中的: 一个典型的内存布局是怎样的: ...

  8. APUE学习笔记——7main()函数启动与退出

    程序的启动与退出过程 先上图,了解进程运行的机制.     内核首先调用exec,运行C启动进程,C启动进程会调用main()函数.     其他所有函数都是由main函数直接或间接调用的.     ...

  9. Nginx常用命令(启动/重启/停止/测试配置文件/重新加载配置文件)

    Nginx 安装后只有一个程序文件,本身并不提供各种管理程序,它是使用参数和系统信号机制对 Nginx 进程本身进行控制的. Nginx 的参数包括有如下几个: 使用: /usr/local/ngin ...

  10. IIS+Asp.Net Mvc必须知道的事(解决启动/重启/自动回收站点后第一次访问慢问题)

    问题现象: Asp.net Mvc站点部署在IIS上后,第一个用户第一次访问站点,都会比较慢,确切的说是访问站点的Action页面(即非静态页面,因为静态页面直接由IIS处理返回给用户即完成请求,而A ...

随机推荐

  1. Oracle中的一些基本sql语句

    --新建表create table table1 (id varchar(300) primary key,name varchar(200) not null);--插入数据insert into ...

  2. ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

    报错 Traceback (most recent call last): File "D:/PyCharm 5.0.3/WorkSpace/2.NLP/2.获取数据源和规范化/4.word ...

  3. 深度学习常见的优化方法(Optimizer)总结:Adam,SGD,Momentum,AdaGard等

    机器学习的常见优化方法在最近的学习中经常遇到,但是还是不够精通.将自己的学习记录下来,以备不时之需 基础知识: 机器学习几乎所有的算法都要利用损失函数 lossfunction 来检验算法模型的优劣, ...

  4. xcode7中搭建python开发环境

    1. 双击打开Xcode 2. 点击File->New->New Project 3. 在左边的面板选择Other,右边选择External Build Sytem,点击Next 4. 输 ...

  5. hdu-6701 Make Rounddog Happy

    题目链接 Make Rounddog Happy Problem Description Rounddog always has an array a1,a2,⋯,an in his right po ...

  6. 【HDU5409】CRB and Graph 边双联通 子树最值

    HDU # 题意 有一个简单图,n个点,m条边.对于每条割边,求出删去这条边后,在两个联通块中各取一个u,v.使得u<v,并且u尽量大而v尽量小. # 思路 求出边双联通是肯定的. 答案的限制条 ...

  7. 牛客 136J-洋灰三角 +高中数学博大精深

    参考学习:http://www.cnblogs.com/l609929321/p/9500814.html 牛客 136J-洋灰三角 题意: 在一个1 * n的棋盘中,第一格放1,之后的每一个放前一个 ...

  8. 什么是Werkzeug

    上一节介绍了什么是WSGI,这一节我们看看Werkzeug 按照官方的说法,Werkzeug(源自德语,工具的意思)是一个WSGI工具库,它开始于一个适用于WSGI的多样化的工具集,后来发展成了现在非 ...

  9. 【Offer】[33] 【二叉搜索树的后序遍历序列】

    题目描述 思路分析 测试用例 Java代码 代码链接 题目描述 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历结果.如果是则返回true, 否则返回false. 假设输入的数组的任意两个数字 ...

  10. 聚焦Python分布式爬虫必学框架Scrapy 打造搜索引擎视频教程

    下载链接:https://www.yinxiangit.com/595.html 目录: 第1章 课程介绍介绍课程目标.通过课程能学习到的内容.和系统开发前需要具备的知识 第2章 windows下搭建 ...