首先,找到 php-fpm
所在的目录:
-
使用
which php-fpm
-
使用
whereis php-fpm
然后找到 php-fpm.conf
所在的目录:
-
使用
ps -ef | grep php-fpm
打开配置文件:
vim /etc/opt/rh/rh-php71/php-fpm.conf
查找 slow
内容,如果没有,看看是否加载了其他位置的配置文件:
include=/etc/opt/rh/rh-php71/php-fpm.d/*.conf
打开其他位置的配置文件:
vim /etc/opt/rh/rh-php71/php-fpm.d/www.conf
查找 slow
内容并启用配置:
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /var/opt/rh/rh-php71/log/php-fpm/www-slow.log
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_slowlog_timeout = 1
创建日志文件:
mkdir -p /var/opt/rh/rh-php71/log/php-fpm/www-slow.log
重启:
kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`
或启动:
/usr/local/bin/php-fpm
配置参考:https://www.php.net/manual/zh/install.fpm.configuration.php