快过年了,服务器总会出些问题让大家忙活下。首先是  5.3.8 爆出大 BUG 来。然后是升级后出现一系列的问题。这几天服务器从 5.3.8 升级到新版本 5.3.9 共出现了:

  • socket() failed (55: No buffer space available) while connecting to upstream(通过切换 spawn-fcgi 为 PHP-FPM 问题好像就没再出现了)
  • Can’t create TCP/IP socket (55) (估计和上面问题类似)
  • 500 内部错误、502 BAD GAYEWAY(由于有台服务器没打开日志 - -! 也不知道是啥问题)
  • Too Many Open Files
这里说下 Too Many Open Files 的问题,当流量达到一定数量的时候(并不一定非常大),程序执行时打开的文件也比较多(50+-,如果你用 ZEND 的话,打开这么多文件也很正常),就可能会出现打开系统文件句柄过多的问题。
如果出现这个问题,首先看看NGINX 和 PHP-FPM 的 rlimit_files 的设置。看下当前打开文件句柄是否已经接近这个值了,最后再看下系统的设置。

相关参数

PHP-FPM.INI

; Set open file descriptor rlimit.
; Default Value: system defined value
;rlimit_files = 1024

NGINX.CONF

worker_rlimit_nofile FDLIMITS;

Specifies the value for maximum file descriptors that can be opened by this process.

FREEBSD

kern.maxfiles

1
kern.maxfiles

 can be raised or lowered based upon your system requirements. This variable indicates the maximum number of file descriptors on your system.

参考

Too Many Open Files

socket() failed (55: No buffer space available) while connecting to upstream

 PHP-MONGO

 

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Set your Twitter account name in your settings to use the TwitterBar Section.