12.21 php-fpm的pool

[root@martin001 etc]# vim php-fpm.conf
[root@martin001 etc]# mkdir php-fpm.d
[root@martin001 etc]# cd php-fpm.d
[root@martin001 php-fpm.d]# vim www.conf
[root@martin001 php-fpm.d]# vim martin.conf
[martin]
listen = /tmp/martin.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
[root@martin001 php-fpm.d]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm  done
[root@martin001 php-fpm.d]# ls /tmp/*.sock
/tmp/martin.sock  /tmp/mysql.sock  /tmp/www.sock
*[root@martin001 php-fpm.d]# ps aux |grep php-fpm*
root       1101  0.1  0.4 227292  4960 ?        Ss   14:07   0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf)
php-fpm    1102  0.0  0.4 227232  4716 ?        S    14:07   0:00 php-fpm: pool martin
php-fpm    1103  0.0  0.4 227232  4720 ?        S    14:07   0:00 php-fpm: pool martin

12.22 php-fpm慢执行日志

vim /usr/local/php-fpm/etc/php-fpm.d/www.conf request_slowlog_timeout = 1 slowlog = /usr/local/php-fpm/var/log/www-slow.log touch /usr/local/php-fpm/var/log/www-slow.log 配置nginx的虚拟主机test.com.conf,把unix:/tmp/php-fcgi.sock改为unix:/tmp/www.sock 重新加载nginx服务 /etc/init.d/php-fpm restart curl -x127.0.0.1:80 test.com/sleep.php

12.23 open_basedir

[root@martin001 etc]# !vim vim php-fpm.d/www.conf php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/ 修改php.ini文件 添加error_log = /usr/local/php-fpm/var/log/php_errors.log 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 curl -x127.0.0.1:80 test.com/3php -I tail /usr/local/php-fpm/var/log/php_errors.log [root@martin001 etc]# tail -2 /usr/local/php-fpm/var/log/php_errors.log [20-Mar-2018 07:51:28 UTC] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /data/wwwroot/test.com/3.php on line 2

12.24 php-fpm进程管理