分类 phpstom 下的文章

nginx,php-fpm报错

网站报502错误
nginx记录信息如下

2016/10/18 15:12:53 [error] 3232#0: *4688 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 111.111.111.111, server: dz.snsnb.com, request: "GET /admin.php?m=content&c=create_html&a=public_index&pc_hash=46yC97 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "xxx.xxx.xxx", referrer: "http://xxx.xxx.xxx/admin.php?m=admin"

信息很模糊,打开php-fpm的日志,发现如下

[18-Oct-2016 11:43:25] WARNING: [pool www] child 24554 exited on signal 9 (SIGKILL) after 82.916762 seconds from start
[18-Oct-2016 11:43:25] NOTICE: [pool www] child 24614 started

child在还没有执行完毕就被杀掉了,想起来程序里面加了段提高内存的代码,如下

ini_set('memory_limit','1024M');

在重启完php-fpm之后段时间内是可以正常运行的,可能是child处理多个请求会使用过多内存,于是被杀掉了,于是把max_requests设置成1,使child每次处理完一次请求之后就重启

pm.max_requests = 1

ok

phpstom调试快捷键说明

F8(step over):逐步执行,遇到函数直接跳过
F7(step into):逐步执行,遇到函数不跳过
F7(force step into):逐步执行,遇到函数不跳过,这个和step into 有什么区别?
F7(step out):跳到下个断点,后面没有断点,结束执行,在函数中就是跳出函数并执行函数后的那行代码
F7(run to cursor):跳到下个断点,后面没有断点,结束执行