nginx php-fpm慢日志slowlog
php-fpm慢日志slowlog设置可以让我们很好的看见哪些php进程速度太慢而导致的网站问题。
可以让我们方便的找到问题的所在。
vi /data1/server/php-cgi/etc/php-fpm.conf
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /data1/log/$pool.log.slow
; 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 = 1s
必须同时设置request_slowlog_timeout 0s表示关闭,就是slowlog没有用
1s表示超过1秒的处理都会被记录。
看看具体执行慢到多少秒
/data1/server/php-cgi/var/log/php-fpm.log
[19-Apr-2013 12:40:35] WARNING: [pool www] child 29514, script '/xx/www/adx/tx/tm.php' (request: "GET /tx/tm.php") executing too slow (1.034708 sec), logging