标签:错误 记录 bin port rest file slow log mit epo
php-fpm的pool[root@akuilinux01 aming.com]# vim /usr/local/php-fpm/etc/php-fpm.conf
[global]
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
include = etc/php-fpm.d/*.conf
[root@akuilinux01 aming.com]# mkdir /usr/local/php-fpm/etc/php-fpm.d
[root@akuilinux01 aming.com]# cd !$
cd /usr/local/php-fpm/etc/php-fpm.d
[root@akuilinux01 php-fpm.d]# vim www.conf
[www]
listen = /tmp/php-fcgi.sock
#listen = 127.0.0.1:9000
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@akuilinux01 php-fpm.d]# vim aming.conf
[aming]
listen = /tmp/aming.sock
#listen = 127.0.0.1:9000
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@akuilinux01 php-fpm.d]# /usr/local/php-fpm/sbin/php-fpm -t
[18-Jun-2018 23:31:06] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful
[root@akuilinux01 php-fpm.d]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
[root@akuilinux01 php-fpm.d]# ps aux |grep php-fpm
root 5306 0.2 0.2 227292 4984 ? Ss 23:31 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf)
php-fpm 5307 0.0 0.2 227232 4724 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5308 0.0 0.2 227232 4724 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5309 0.0 0.2 227232 4724 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5310 0.0 0.2 227232 4724 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5311 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5312 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5313 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5314 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5315 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5316 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5317 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5318 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5319 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5320 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5321 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5322 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5323 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5324 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5325 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5326 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool aming
php-fpm 5327 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5328 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5329 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5330 0.0 0.2 227232 4728 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5331 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5332 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5333 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5334 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5335 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5336 0.0 0.2 227232 4732 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5337 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5338 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5339 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5340 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5341 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5342 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5343 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5344 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5345 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
php-fpm 5346 0.0 0.2 227232 4736 ? S 23:31 0:00 php-fpm: pool www
root 5350 0.0 0.0 112680 984 pts/1 S+ 23:32 0:00 grep --color=auto php-fpm
[root@akuilinux01 ~]# vim /usr/local/php-fpm/etc/php-fpm.d/www.conf
request_slowlog_timeout = 1
#当请求超过1秒开始记录日志
slowlog = /usr/local/php-fpm/var/log/www-slow.log
#日志存放地址
[root@akuilinux01 ~]# vim /data/wwwroot/test.com/sleep.php
<?php
echo "test slow log";
sleep(2);
echo "done";
?>
[root@akuilinux01 ~]# curl -x127.0.0.1:80 test.com/sleep.php
test slow logdone
[root@akuilinux01 ~]# cat /usr/local/php-fpm/var/log/www-slow.log
[19-Jun-2018 08:58:20] [pool www] pid 1451
script_filename = /data/wwwroot/test.com/sleep.php
[0x00007f4cadc922e0] sleep() /data/wwwroot/test.com/sleep.php:3
[root@akuilinux01 ~]# vim /usr/local/php-fpm/etc/php-fpm.d/www.conf
php_admin_value[open_basedir]=/data/wwwroot/eetest.com:/tmp/
#故意写错/data/wwwroot/eetest.com,正确是/data/wwwroot/test.com
[root@akuilinux01 ~]# curl -x127.0.0.1:80 test.com/sleep.php -I
HTTP/1.1 404 Not Found
Server: nginx/1.14.0
Date: Tue, 19 Jun 2018 01:21:13 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.6.30
[root@akuilinux01 ~]# vim /usr/local/php-fpm/etc/php-fpm.d/www.conf
[root@akuilinux01 ~]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
[root@akuilinux01 ~]# curl -x127.0.0.1:80 test.com/sleep.php
test slow logdone
[root@akuilinux01 ~]# vim /usr/local/php-fpm/etc/php.ini
error_reporting = E_ALL
display_errors = Off
;error_log = syslog
error_log = /usr/local/php-fpm/var/log/php_errors.log
[root@akuilinux01 ~]# touch /usr/local/php-fpm/var/log/php_errors.log
[root@akuilinux01 ~]# chmod 777 /usr/local/php-fpm/var/log/php_errors.log
[root@akuilinux01 ~]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
[root@akuilinux01 ~]# vim /usr/local/php-fpm/etc/php-fpm.d/www.conf
php_admin_value[open_basedir]=/data/wwwroot/eetest.com:/tmp/
#故意写错/data/wwwroot/eetest.com,正确是/data/wwwroot/test.com
[root@akuilinux01 ~]# curl -x127.0.0.1:80 test.com/sleep.php -I
HTTP/1.1 404 Not Found
Server: nginx/1.14.0
Date: Tue, 19 Jun 2018 01:34:14 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.6.30
[root@akuilinux01 ~]# cat /usr/local/php-fpm/var/log/php_errors.log
[19-Jun-2018 01:32:53 UTC] PHP Deprecated: Comments starting with ‘#‘ are deprecated in Unknown on line 1 in Unknown on line 0
[19-Jun-2018 01:32:53 UTC] PHP Deprecated: Comments starting with ‘#‘ are deprecated in Unknown on line 1 in Unknown on line 0
[19-Jun-2018 01:34:14 UTC] PHP Warning: Unknown: open_basedir restriction in effect. File(/data/wwwroot/test.com/sleep.php) is not within the allowed path(s): (/data/wwwroot/eetest.com:/tmp/) in Unknown on line 0
[19-Jun-2018 01:34:14 UTC] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[root@akuilinux01 ~]# cat /usr/local/php-fpm/etc/php-fpm.d/www.conf
[www]
listen = /tmp/www.sock
;listen = 127.0.0.1:9000
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
request_slowlog_timeout = 1
slowlog = /usr/local/php-fpm/var/log/www-slow.log
php_admin_value[open_basedir]=/data/wwwroot/test.com:/tmp/
php-fpm的pool、PHP慢执行日志、open_basedir、php-fpm进程管理
标签:错误 记录 bin port rest file slow log mit epo
原文地址:http://blog.51cto.com/akui2521/2130452