php – 失败(104:由同行重置连接)

前端之家收集整理的这篇文章主要介绍了php – 失败(104:由同行重置连接)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我们使用的是PHP5-fpm和Nginx.

  1.  
  2. # Nginx -v
  3. Nginx version: Nginx/1.1.19
  1. *
  2.  
  3. # PHP -v
  4. PHP 5.3.27-1~dotdeb.0 with Suhosin-Patch (cli) (built: Jul 25 2013 19:30:39)
  5. Copyright (c) 1997-2013 The PHP Group
  6. Zend Engine v2.3.0,Copyright (c) 1998-2013 Zend Technologies
  7. with Xdebug v2.2.3,Copyright (c) 2002-2013,by Derick Rethans
  8.  
  9. *

得到以下错误,

  1.  
  2. 2013/08/21 20:00:20 [error] 12740#0: *46 recv() Failed (104: Connection reset by peer) while reading response header from upstream,client: 172.17.7.12,server: fe.test.local,request: "GET /search?gender=female&ageFrom=20&ageTo=32&religionId=&casteId=&countryId=&heightFrom=&heightTo=&profileImageStatus=%28y+p%29&search=Search HTTP/1.1",upstream: "fastcgi://unix:/var/run/PHP5-fpm.sock:",host: "fe.test.local",referrer: "http://fe.test.local/
  3.  

PHP5-FPM配置,

  1.  
  2. # grep ^[^\;] /etc/PHP5/fpm/PHP-fpm.conf
  3.  
  4. [global]
  5. pid = /var/run/PHP5-fpm.pid
  6. error_log = /var/log/PHP5-fpm.log
  7. log_level = notice
  8. process_control_timeout = 30
  9. include=/etc/PHP5/fpm/pool.d/*.conf
  10.  
  1.  
  2. # grep ^[^\;] /etc/PHP5/fpm/pool.d/www.conf
  3. [www]
  4. listen = /var/run/PHP5-fpm.sock
  5. listen.backlog = -1
  6. user = www-data
  7. group = www-data
  8. pm = dynamic
  9. pm.max_children = 10
  10. pm.start_servers = 4
  11. pm.min_spare_servers = 2
  12. pm.max_spare_servers = 6
  13. rlimit_files = 131072
  14. rlimit_core = unlimited
  15. chdir = /
  16.  

Nginx fascgi配置部分

  1.  
  2. location ~ \.PHP$
  3. {
  4. fastcgi_index index.PHP;
  5. include fastcgi_params;
  6. fastcgi_connect_timeout 120;
  7. fastcgi_send_timeout 600;
  8. fastcgi_read_timeout 600;
  9. fastcgi_buffers 8 256k;
  10. fastcgi_buffer_size 256k;
  11. fastcgi_busy_buffers_size 256k;
  12. fastcgi_temp_file_write_size 256k;
  13. client_max_body_size 20M;
  14. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  15. #fastcgi_pass 127.0.0.1:9000;
  16. fastcgi_pass unix:/var/run/PHP5-fpm.sock;
  17. }
  18.  
  1.  
  2. # strace -f -s 8000 -p 12761
  3. Process 12761 attached - interrupt to quit
  4. epoll_wait(9,{},1,944) = 0
  5. epoll_wait(9,1000) = 0
  6. epoll_wait(9,269f530,1000) = -1 EINTR (Interrupted system call)
  7. --- SIGCHLD (Child exited) @ 0 (0) ---
  8. write(6,"C",1) = 1
  9. rt_sigreturn(0x6) = -1 EINTR (Interrupted system call)
  10. epoll_wait(9,{{EPOLLIN,{u32=15427040,u64=15427040}}},122) = 1
  11. read(4,1) = 1
  12. wait4(-1,[{WIFEXITED(s) && WEXITSTATUS(s) == 127}],WNOHANG|WSTOPPED,NULL) = 12826
  13. write(3,"[21-Aug-2013 19:33:37] WARNING: [pool www] child 12826 exited with code 127 after 275.844033 seconds from start\n",112) = 112
  14. clone(Process 12832 attached (waiting for parent)
  15. Process 12832 resumed (parent 12761 ready)
  16. child_stack=0,flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,child_tidptr=0x7fd7a31cfa10) = 12832
  17. [pid 12832] set_robust_list(0x7fd7a31cfa20,0x18) = 0
  18. [pid 12832] dup2(1,2) = 2
  19. [pid 12832] close(3) = 0
  20. [pid 12832] dup2(7,0) = 0
  21. [pid 12832] geteuid() = 0
  22. [pid 12832] setrlimit(RLIMIT_NOFILE,{rlim_cur=128*1024,rlim_max=128*1024}) = 0
  23. [pid 12832] setrlimit(RLIMIT_CORE,{rlim_cur=RLIM_INFINITY,rlim_max=RLIM_INFINITY}) = 0
  24. [pid 12832] chdir("/") = 0
  25. [pid 12832] setgid(33) = 0
  26. [pid 12832] open("/proc/sys/kernel/ngroups_max",O_RDONLY) = 3
  27. [pid 12832] read(3,"65536\n",31) = 6
  28. [pid 12832] close(3) = 0
  29. [pid 12832] open("/etc/group",O_RDONLY|O_CLOEXEC) = 3
  30. [pid 12832] lseek(3,SEEK_CUR) = 0
  31. [pid 12832] fstat(3,{st_mode=S_IFREG|0644,st_size=777,...}) = 0
  32. [pid 12832] mmap(NULL,777,PROT_READ,MAP_SHARED,3,0) = 0x7fd7a31c1000
  33. [pid 12832] lseek(3,SEEK_SET) = 777
  34. [pid 12832] fstat(3,...}) = 0
  35. [pid 12832] munmap(0x7fd7a31c1000,777) = 0
  36. [pid 12832] close(3) = 0
  37. [pid 12832] setgroups(1,[33]) = 0
  38. [pid 12832] setuid(33) = 0
  39. [pid 12832] prctl(PR_SET_DUMPABLE,1) = 0
  40. [pid 12832] close(4) = 0
  41. [pid 12832] close(6) = 0
  42. [pid 12832] rt_sigaction(SIGTERM,{SIG_DFL,[],SA_RESTORER,0x7fd7a02234a0},NULL,8) = 0
  43. [pid 12832] rt_sigaction(SIGINT,8) = 0
  44. [pid 12832] rt_sigaction(SIGUSR1,8) = 0
  45. [pid 12832] rt_sigaction(SIGUSR2,8) = 0
  46. [pid 12832] rt_sigaction(SIGCHLD,8) = 0
  47. [pid 12832] rt_sigaction(SIGQUIT,{0x7633f0,SA_RESTORER|SA_RESTART,8) = 0
  48. [pid 12832] close(7) = 0
  49. [pid 12832] accept(0,[pid 12761] write(3,"[21-Aug-2013 19:33:37] NOTICE: [pool www] child 12832 started\n",62) = 62
  50. [pid 12761] wait4(-1,0x7fff07258a7c,NULL) = 0
  51. [pid 12761] read(4,0x7fff07258b5f,1) = -1 EAGAIN (Resource temporarily unavailable)
  52. [pid 12761] epoll_wait(9,108) = 0
  53. [pid 12761] epoll_wait(9,1000) = 0
  54. [pid 12761] epoll_wait(9,1000) = -1 EINTR (Interrupted system call)
  55. [pid 12761] --- SIGCHLD (Child exited) @ 0 (0) ---
  56. [pid 12761] write(6,1) = 1
  57. [pid 12761] rt_sigreturn(0x6) = -1 EINTR (Interrupted system call)
  58. [pid 12761] epoll_wait(9,769) = 1
  59. [pid 12761] read(4,1) = 1
  60. [pid 12761] wait4(-1,NULL) = 12830
  61. [pid 12761] write(3,"[21-Aug-2013 19:33:39] WARNING: [pool www] child 12830 exited with code 127 after 10.053632 seconds from start\n",111) = 111
  62. [pid 12761] clone(Process 12833 attached
  63. child_stack=0,child_tidptr=0x7fd7a31cfa10) = 12833
  64. [pid 12761] write(3,"[21-Aug-2013 19:33:39] NOTICE: [pool www] child 12833 started\n",[pid 12833] set_robust_list(0x7fd7a31cfa20,0x18) = 0
  65. [pid 12833] dup2(1,2) = 2
  66. [pid 12833] close(3) = 0
  67. [pid 12833] dup2(7,0) = 0
  68. [pid 12833] geteuid() = 0
  69. [pid 12833] setrlimit(RLIMIT_NOFILE,rlim_max=128*1024}) = 0
  70. [pid 12833] setrlimit(RLIMIT_CORE,rlim_max=RLIM_INFINITY}) = 0
  71. [pid 12833] chdir("/") = 0
  72. [pid 12833] setgid(33) = 0
  73. [pid 12833] open("/proc/sys/kernel/ngroups_max",O_RDONLY) = 3
  74. [pid 12833] read(3,31) = 6
  75. [pid 12833] close(3) = 0
  76. [pid 12833] open("/etc/group",O_RDONLY|O_CLOEXEC) = 3
  77. [pid 12833] lseek(3,SEEK_CUR) = 0
  78. [pid 12833] fstat(3,...}) = 0
  79. [pid 12833] mmap(NULL,0) = 0x7fd7a31c1000
  80. [pid 12833] lseek(3,SEEK_SET) = 777
  81. [pid 12833] fstat(3,...}) = 0
  82. [pid 12833] munmap(0x7fd7a31c1000,777) = 0
  83. [pid 12833] close(3) = 0
  84. [pid 12833] setgroups(1,[33]) = 0
  85. [pid 12833] setuid(33) = 0
  86. [pid 12833] prctl(PR_SET_DUMPABLE,1) = 0
  87. [pid 12833] close(4) = 0
  88. [pid 12833] close(6) = 0
  89. [pid 12833] rt_sigaction(SIGTERM,8) = 0
  90. [pid 12833] rt_sigaction(SIGINT,8) = 0
  91. [pid 12833] rt_sigaction(SIGUSR1,8) = 0
  92. [pid 12833] rt_sigaction(SIGUSR2,8) = 0
  93. [pid 12833] rt_sigaction(SIGCHLD,8) = 0
  94. [pid 12833] rt_sigaction(SIGQUIT,8) = 0
  95. [pid 12833] close(7) = 0
  96. [pid 12833] accept(0,[pid 12761] {},766) = 0
  97. [pid 12761] epoll_wait(9,1000) = 0`enter code here`
  98. [pid 12761] epoll_wait(9,1000) = 0
  99.  
最佳答案
上面的Nginx错误表明该问题与fastcgi(PHP-fpm)有关.

在/etc/PHP5/fpm/pool.d/www.conf上启用“catch_workers_output”之后
PHP5-fpm.log上得到了相关的错误.现在了解该问题与AMQP模块有关.

[2013年8月21日23:32:57]警告:[池www]孩子16091对stderr说:“PHP-fpm:pool www:符号查找错误:/usr/lib/PHP5/20090626/amqp.so:undefined符号:amqp_open_socket“

重新编译并安装amqp模块后修复了问题

猜你在找的Nginx相关文章