启用 php-fpm 的 slow log 日志 ,查看 执行 时间过长的php文件,并将 执行 时间过长的进程直接终止掉!看看效果如何! 具体操作方法也简单,就修改一个文件, 执行 命令:# vi /usr/local/php/etc/php-fpm.conf PHP 5.3.3 之前版本设置如下: The timeout (
启用 php-fpm 的 slow log 日志,查看执行时间过长的php文件,并将执行时间过长的进程直接终止掉!看看效果如何!
具体操作方法也简单,就修改一个文件,执行命令:# vi /usr/local/php/etc/php-fpm.conf
PHP 5.3.3 之前版本设置如下:
The timeout (in seconds) for serving a single request after which the worker process will be terminated Should be used when 'max_execution_time' ini option does not stop script execution for some reason '0s' means 'off' <value name="<span><strong>request_terminate_timeout</strong></span>"><span><strong>10s</strong></span></value> The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file '0s' means 'off' <value name="<span><strong>request_slowlog_timeout</strong></span>"><span><strong>1s</strong></span></value> The log file for slow requests <value name="slowlog">logs/slow.log</value>
PHP 5.3.3 之后版本设置如下:
; 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 (对<strong><strong>执行</strong></strong>时间超过1s的php脚本进行<strong>日志</strong>记录) ; The log file for slow requests ; Default Value: /usr/local/php/var/log/php-fpm.log.slow slowlog = /usr/local/php/var/log/php-fpm.log.slow (开启慢<strong><strong>执行</strong></strong><strong>日志</strong>,<strong>日志</strong>目录路径一定要正确存在,否则会报错) ; The timeout for serving a single request after which the worker process will ; be killed. This option should be used when the 'max_execution_time' ini option ; does not stop script execution for some reason. A value of '0' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 request_terminate_timeout = 30s (当php脚本<strong><strong>执行</strong></strong>时间超过30秒后终止该php脚本)
注:request_terminate_timeout 将执行时间太长的进程直接终止
request_slowlog_timeout 将执行过慢的文件写入日志
以后即可根据慢执行日志 /usr/local/php/var/log/slow.log 来优化程序文件了!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

맨티스BT
Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

PhpStorm 맥 버전
최신(2018.2.1) 전문 PHP 통합 개발 도구

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.
