简体   繁体   English

php-fpm太多打开的文件

[英]php-fpm Too many open files

I'm running nginx as frontend and php-fpm as backend to prcesss php files. 我正在运行nginx作为前端和php-fpm作为prcesss php文件的后端。 I'm getting "Too many open files" error on my /var/log/php-fpm/error.log. 我的/var/log/php-fpm/error.log上出现“打开文件太多”的错误。 I've increased hard & soft ulimit to 65535 and It seems can't solve the problem. 我将硬和软ulimit增加到65535,似乎无法解决问题。

/var/log/php-fpm/error.log /var/log/php-fpm/error.log

[17-Sep-2012 14:43:51] ERROR: failed to prepare the stderr pipe: Too many open files (24)
[17-Sep-2012 14:43:52] ERROR: failed to prepare the stderr pipe: Too many open files (24)

ulimit -n ulimit -n

65535

/etc/php-fpm/www.conf /etc/php-fpm/www.conf

rlimit_files = 65535

You could check with lsof (list open files), probably need to install it as most linux distro's don't include this by default. 您可以查看lsof (列出打开的文件),可能需要安装它,因为大多数Linux发行版默认情况下不包含此项。 It should give you a view on which ones those open files are and the processes that own it (so you can grep for php). 它应该给你一个关于那些打开文件是什么以及拥有它的进程的视图(所以你可以grep for php)。 do a lsof | 做一个lsof | wc -l to count those. wc -l来统计那些。 Are there really that much open ? 真的那么开放吗? Or perhaps the error is more like a symptom of something deeper. 或许错误更像是更深层次的症状。 If you know what they are, perhaps that will give a clue to the why... 如果你知道它们是什么,也许这将给出原因......

Looking at the fact that it mentions STDERR it's probably error related in the broad sense (error configuration parameters for php-fpm perhaps?) 看一下它提到STDERR的事实,它可能与广义上的错误有关(也许是php-fpm的错误配置参数?)

Also, check to see if you are using a unix socket or a tcp one, try the tcp option unless you are on BSD where the unix sockets are reputed to work faster. 此外,检查您是使用unix套接字还是使用tcp,请尝试使用tcp选项,除非您使用的是BSD,其中unix套接字被认为可以更快地工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM