7 centos php 每分钟执行_【CentOS 7LNMP架构38】,php -fpm慢执行日志#180110

hellopasswd

php -fpm慢执行日志

vi /usr/local/php-fpm/etc/php-fpm.d/www.conf

request_slowlog_timeout=1

slowlog=/usr/local/php-fpm/var/log/www-slow.log

配置nginx的虚拟主机test.com.conf,把unix:/tmp/php-fcgi.sock改为unx:/tmp/www.sock

重新加载nginx服务

vi /data/wwwroot/test.com/sleep.php

echo "test slow log";

sleep(2);

echo "done";

?>

curl -x 127.0.0.1:80 test.com/sleep.php

cat /usr/local/php-fpm/var/log/www-slow.log

[root@localhost php-fpm.d]# vi www.conf

1 [www]

2 listen = /tmp/php-fcgi.sock

3 listen.mode = 666

4 user = php-fpm

5 group = php-fpm

6 pm = dynamic

7 pm.max_children = 50

8 pm.start_servers = 20

9 pm.min_spare_servers = 5

10 pm.max_spare_servers = 35

11 pm.max_requests = 500

12 rlimit_files = 1024

13 request_slowlog_timeout = 1

14 slowlog = /usr/local/php-fpm/var/log/www-slow.log

[root@localhost php-fpm.d]# /usr/local/php-fpm/sbin/php-fpm -t

[10-Jan-2018 08:13:55] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful

[root@localhost php-fpm.d]# /etc/init.d/php-fpm reload

Reload service php-fpm done

[root@localhost php-fpm.d]# ls /usr/local/php-fpm/var/log/

php-fpm.log www-slow.log

[root@localhost php-fpm.d]# vi /data/wwwroot/test.com/sleep.php

1 <?php

2 echo "test slow log";

3 sleep(2);

4 echo "done";

5 ?>

[root@localhost php-fpm.d]# curl -x 127.0.0.1:80 test.com/sleep.php

[root@localhost php-fpm.d]# vi /usr/local/php-fpm/etc/php.ini

/display_errors

462 ; Default Value: On

463 ; Development Value: On

464 ; Production Value: Off

465 ; http://php.net/display-errors

466 display_errors = Off

467

468 ; The display of errors which occur during PHP's startup sequence are handled

469 ; separately from display_errors. PHP's default behavior is to suppress those

470 ; errors from clients. Turning the display of startup errors on can be useful in

471 ; debugging configuration problems. We strongly recommend you

472 ; set this to 'off' for production servers.

473 ; Default Value: Off

将display_errors = Off改为On

[root@localhost php-fpm.d]# vi /usr/local/php-fpm/etc/php.ini

/display_errors

462 ; Default Value: On

463 ; Development Value: On

464 ; Production Value: Off

465 ; http://php.net/display-errors

466 display_errors = On

467

468 ; The display of errors which occur during PHP's startup sequence are handled

469 ; separately from display_errors. PHP's default behavior is to suppress those

470 ; errors from clients. Turning the display of startup errors on can be useful in

471 ; debugging configuration problems. We strongly recommend you

472 ; set this to 'off' for production servers.

473 ; Default Value: Off

[root@localhost php-fpm.d]# /etc/init.d/php-fpm reload

Reload service php-fpm done

[root@localhost php-fpm.d]# curl -x 127.0.0.1:80 test.com/sleep.php

[root@localhost php-fpm.d]# cat /usr/local/php-fpm/var/log/www-slow.log

修改于 180110

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值