大网数据广告活动
服务器运维问答

Let PHP-FPM report the script's current line number on timeout

· 52CE 我爱测

My website is running successfully on PHP-FPM with NGINX on Debian. Timeout period is set at 300 seconds for NGINX. This is enough for most pages, but some scripts get stuck. I can't reproduce the issue in testing, so I would lik…

问题原文

原帖链接 · i.amniels · CC BY-SA 4.0

My website is running successfully on PHP-FPM with NGINX on Debian. Timeout period is set at 300 seconds for NGINX. This is enough for most pages, but some scripts get stuck. I can't reproduce the issue in testing, so I would like to know where the script is stuck. Can PHP-FPM report the last line number when a time out occurs?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

You can enable the php-fpm slow log. If a request takes more than a configurable amount of time, php-fpm will dump a stack trace to a log file.

An example configuration, which goes into your php-fpm pool configuration file:

slowlog = /var/log/php5/slow.log
request_slowlog_timeout = 5s

In this case, any request that takes more than 5 seconds of wall clock time will get a stack dump into /var/log/php5/slow.log.

Note that the request will continue running.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-10-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。