The main content of this article is about using PHP-FPM to enable slow logging. It has certain learning value. Interested friends can learn about it.
fpm: FastCGI Process Manager is an alternative PHP FastCGI implementation that is useful for sites with heavy loads.
1. Advanced process control, graceful stop and start
2. Able to use different uid/gid/chroot/environment to start workers, use different php.ini, and listen to different ports
3.stdout stderr logging
4.Emergency restart in case of opcode cache damage
5.Accelerated upload support
6.slowlog slow logging script, which can record PHP tracking and remote process execute_data, ptrace or similar tools to read Fetching and analysis
7.fastcgi_finish_request() refreshes all data. When doing time-consuming operations, such as video conversion and statistical processing, after fastcgi_finish_request(), the script will still occupy the FPM process. Therefore, overusing it for long-running tasks may occupy all FPM threads until pm.max_children
8. Dynamic static child process generation
9. Basic SPAI state, based on php.ini configuration file
php-fpm Enable slow query log:
/etc/php/7.0/fpm/pool.d/www.conf slowlog = /var/log/php-fpm-$pool.log.slow //日志目录 request_slowlog_timeout = 5 //超时时间
Related tutorials: PHP video tutorial
The above is the detailed content of PHP-FPM enables slow logging method. For more information, please follow other related articles on the PHP Chinese website!