企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
《日志-php-fpm慢日志查询》 http://blog.csdn.net/ty_hf/article/details/55504172 《PHP7中php.ini、php-fpm和www.conf的配置》 https://typecodes.com/web/php7configure.html >注:PHP7的慢日志不在php-fpm.conf中,可以看看上边第2篇文章。以下是针对 `PHP7` 来操作的! ## 1.查找相关文件 ``` find / -name php-fpm.conf vim /usr/local/php/etc/php-fpm.conf ``` 查看最末行有一个 ``` include=/usr/local/php/etc/php-fpm.d/*.conf ``` 我们打开`/usr/local/php/etc/php-fpm.d`目录,有一个 `www.conf` ,打开一个文件 ``` vim www.conf ``` ## 2.更改参数1 将`;slowlog = log/$pool.log.slow`更改为:`slowlog = /var/log/php-fpm-slow/$pool.log.slow` ## 3.更改参数2 将 `;request_slowlog_timeout = 0` 更改为 `request_slowlog_timeout = 2s` ## 4.重新启动 ``` /etc/init.d/php-fpm stop /etc/init.d/php-fpm start ``` ## 5.查看 ``` cd /var/log/php-fpm-slow //注:到该目录下查看文件即可! ``` ## 6.分析其中一段 ``` [21-Dec-2018 16:17:27] [pool www] pid 5180 script_filename = /var/www/health.sxctkj.cc/public/index.php [0x00007f91f5c15c60] curl_exec() /var/www/health.sxctkj.cc/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php:107 [0x00007f91f5c15660] sendRequest() /var/www/health.sxctkj.cc/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Http/Client.php:56 [0x00007f91f5c15220] multipartPost() /var/www/health.sxctkj.cc/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php:60 [0x00007f91f5c14ee0] put() /var/www/health.sxctkj.cc/simplewind/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php:57 [0x00007f91f5c14dd0] put() /var/www/health.sxctkj.cc/app/extendService/QiniuService.php:36 [0x00007f91f5c14bf0] updateImg() /var/www/health.sxctkj.cc/app/api/controller/UserController.php:584 [0x00007f91f5c147d0] avatarUpload() /var/www/health.sxctkj.cc/simplewind/thinkphp/library/think/App.php:343 [0x00007f91f5c14750] invokeArgs() /var/www/health.sxctkj.cc/simplewind/thinkphp/library/think/App.php:343 [0x00007f91f5c14470] invokeMethod() /var/www/health.sxctkj.cc/simplewind/thinkphp/library/think/App.php:595 [0x00007f91f5c13c40] module() /var/www/health.sxctkj.cc/simplewind/thinkphp/library/think/App.php:456 [0x00007f91f5c13910] exec() /var/www/health.sxctkj.cc/simplewind/thinkphp/library/think/App.php:139 [0x00007f91f5c13210] run() /var/www/health.sxctkj.cc/public/index.php:41 ```