First, the pool of PHP-FPM
vim/usr/local/php/etc/php-fpm.conf//added in [Global] section
Include = etc/php-fpm.d/*.conf
mkdir/usr/local/php/etc/php-fpm.d/
cd/usr/local/php/etc/php-fpm.d/
Vim www.conf//content as follows
[WWW]
Listen =/tmp/www.sock
listen.mode=666
user = PHP-FPM
Group = PHP-FPM
PM = dynamic
Pm.max_children = 50
Pm.start_servers = 20
Pm.min_spare_servers = 5
Pm.max_spare_servers = 35
Pm.max_requests = 500
Rlimit_files = 1024
continue editing the configuration file
Vim aming.conf// content as follows
[Aming]
Listen =/tmp/aming.sock
listen.mode=666
user = PHP-FPM
Group = PHP-FPM
PM = dynamic
Pm.max_children = 50
Pm.start_servers = 20
Pm.min_spare_servers = 5
Pm.max_spare_servers = 35
Pm.max_requests = 500
Rlimit_files = 1024
/USR/LOCAL/PHP/SBIN/PHP-FPM –t
/ETC/INIT.D/PHP-FPM restart
Second, php-fpm slow execution log
vim/usr/local/php-fpm/etc/php-fpm.d/www.conf// Add the following:
Request_slowlog_timeout = 1
Slowlog =/usr/local/php-fpm/var/log/www-slow.log
Configure nginx virtual host test.com.conf, change unix:/tmp/php-fcgi.sock to Unix:/tmp/www.sock
Reload nginx service
vim/data/wwwroot/test.com/sleep.php// writes the following:
<?php echo "test Slow log"; sleep (2); Echo "done" ;? >
Curl-x127.0.0.1:80 test.com/sleep.php
Cat/usr/local/php-fpm/var/log/www-slow.log
Third, Open_basedir
vim/usr/local/php-fpm/etc/php-fpm.d/aming.conf// Add the following:
php_admin_value[open_basedir]=/data/wwwroot/aming.com:/tmp/
Create a Test php script to test
change aming.conf again, modify the path, test again
Configuration error Log
Test Again
Viewing the error log
Iv. PHP-FPM Process Management
PM = Dynamic/Active process management, also can be static
Pm.max_children =// max number of sub-processes,PS aux can be viewed
Pm.start_servers =// number of processes that will start when the service is started
Pm.min_spare_servers = 5// defines the minimum number of child processes in the idle period, and if this value is reached,thephp-fpm service automatically derives the new child process.
Pm.max_spare_servers = +// defines the maximum number of child processes in the idle period, or, if higher than this value, to start cleaning up idle child processes.
Pm.max_requests =// defines the maximum number of requests processed by a child process, that is, a php-fpm child process can handle so many requests, and when this value is reached, it automatically exits
Linux centosvmware php-fpm pool, php-fpm slow execution log, Open_basedir