【PHP】MAC下,PHP-FPM 无法停止,停止后自动重启

 

一、php-fpm的命令使用

Usage: php [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>] [-D] [-F [-O]]
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -h               This help
  -i               PHP information
  -m               Show compiled in modules
  -v               Version number
  -p, --prefix <dir>
                   Specify alternative prefix path to FastCGI process manager (default: /usr/local/Cellar/php/8.0.3).
  -g, --pid <file>
                   Specify the PID file location.
  -y, --fpm-config <file>
                   Specify alternative path to FastCGI process manager config file.
  -t, --test       Test FPM configuration and exit
  -D, --daemonize  force to run in background, and ignore daemonize option from config file
  -F, --nodaemonize
                   force to stay in foreground, and ignore daemonize option from config file
  -O, --force-stderr
                   force output to stderr in nodaemonize even if stderr is not a TTY
  -R, --allow-to-run-as-root
                   Allow pool to run as root (disabled by default)

 

php 中php-fpm 的重启、终止操作命令:

service nginx restart

service php-fpm restart

查看php-fpm进程数:

ps aux | grep -c php-fpm

重启php-fpm

/etc/init.d/php-fpm restart

二、重启命令

INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块

查看进程

hadesdeMacBook-Pro:run test$ ps aux|grep php-fpm
test             53996   0.0  0.0  4493632    528   ??  S     8:37下午   0:00.00 /usr/local/opt/php/sbin/php-fpm --nodaemonize
test             53980   0.0  0.0  4493632    488   ??  S     8:37下午   0:00.00 /usr/local/opt/php/sbin/php-fpm --nodaemonize
test             53978   0.0  0.1  4493888   9584   ??  S     8:37下午   0:00.09 /usr/local/opt/php/sbin/php-fpm --nodaemonize
test             54220   0.0  0.0  4286452    828 s022  S+    8:43下午   0:00.01 grep php-fpm

查找pid的位置

[global]
; Pid file
; Note: the default prefix is /usr/local/var
; Default Value: none
;pid = run/php-fpm.pid

php-fpm 关闭:

kill -INT `cat /var/run/php-fpm/php-fpm.pid`

php-fpm 重启:

kill -USR2 `cat /var/run/php-fpm/php-fpm.pid`

三、问题解决

在 Mac 的 ~/Library/LaunchAgents 下发现了 homebrew.mxcl.php.plist 的文件,这是 Mac 的系统自启文件,删除此文件重启后,就可以了。

四、参考资料

PHP-FPM 无法停止,停止后自动重启

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值