12.21 PHP-FPM's Pool
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
/usr/local/php-fpm/sbin/php-fpm-t
/ETC/INIT.D/PHP-FPM Reload
PS aux | grep php-fpm
12.22 php-fpm Slow Execution log
PHP website is running slowly, log view error reason
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:/tpm/www.sock
Reload Nginx Service
vim/data/wwwroot/test.com/sleep.php//write the following:
<?php echo "Test slow Log"; sleep (2); echo "Done";? >
Curl-x127.0.0.1:80 Test.com/sleep.php-i
If you report 500 errors,
Vi/usr/local/php-fpm/etc/php.ini
//change to Display_errors = on
/ETC/INIT.D/PHP-FPM Reload
Cat/usr/local/php-fpm/var/log/www-slow.log
12.23 Open_basedir
vim/usr/local/php-fpm/etc/php-fpm.d/aming.conf//[www] Add the following:
php_admin_value[open_basedir]=/data/wwwroot/aming.com:/tmp/
/ETC/INIT.D/PHP-FPM restart
Create a test PHP script to test
curl-x127.0.0.1:80 test.com/sleep.php- I.
Change aming.conf again, modify the path, test again
Configuration error Log
Vim/usr/local/php-fpm/etc/php.ini
instead display_errors =Off
Error_log =/usr/local/php-fpm/var/log/php_errors.log
Error_reporting =e_all
Touch/usr/local/php-fpm/var/log/php_errors.log
chmod 777/usr/local/php-fpm/var/log/php_errors.log
/ETC/INIT.D/PHP-FPM restart
Test again
curl-x127.0.0.1:80 test.com/sleep.php- I.
Viewing the error log
Cat/usr/local/php-fpm/var/log/php_fpm/var/log/php_errors.log
12.24 PHP-FPM Process Management
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
Linux Learning Notes 13 week Lesson (May 2)