PHP无法打开流:打开的文件太多 [英] PHP failed to open stream: Too many open files

查看:76
本文介绍了PHP无法打开流:打开的文件太多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对以下错误有疑问:PHP无法打开流:打开的文件太多.

I have a problem with the error: PHP failed to open stream: Too many open files.

我已经在这里查看了关于stackoverflow的各种答案,但是我无法解决此问题.我主要尝试增加最大限制.打开文件:

I have looked on various answers here on stackoverflow, but I am unable to solve this issue. I have mainly tried to increase the limit of max. open files:

我在/etc/security/limits.conf中指定了以下内容:

I have edited /etc/security/limits.conf where I specified this:

*       soft    nofile      10000
*       hard    nofile      30000

保存并注销/重新启动该框后,命令:

After saving and logging out / rebooting the box, the command:

ulimit -n

仍然打印出1024.我不确定为什么这没有效果,我认为这是我收到php错误的原因.如果需要,我可以粘贴整个文件或任何其他配置文件.我正在使用PHP 5.6,nginx 1.8.0和php-fpm.

Still prints out 1024. I am not sure why this has no effect and I think this is the reason I get the php error. If needed I can paste the whole file or any other configuration file. I am using PHP 5.6, nginx 1.8.0 and php-fpm.

现在适用于我的解决方案是使用以下命令手动重新启动nginx:

The solution which works for me now is to manually restart nginx with:

service nginx restart

在此之后,事情又恢复了.主要是当我运行单元测试,behat测试或向Web服务器发出大量请求时出现问题.

After this things work again. Mainly the problem occurs when I run unit tests, behat tests or when I make a lot of requests to the web server.

推荐答案

解决方案是执行无用的暂停,然后再次使无用的ssh.然后它打印出10000.看起来像简单的注销,由于某种原因,用用户登录还不够.

The solution was to do vagrant halt and then vagrant ssh again. Then it printed out the 10000. Looks like simple logout and login with the user was not enough for some reason.

这篇关于PHP无法打开流:打开的文件太多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆