Apache的PHP / OSX小牛: - 未能打开流:打开的文件太多 [英] Apache PHP/OSX Mavericks: - failed to open stream: Too many open files

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

问题描述

我最近升级到OSX小牛队,从那时起,我开始让我的开发机上前面提到的错误。有一个在code(这是产生的Yii 示例应用程序自动),没有明显的问题。发生了什么事是升级到小牛队的部分是:


  1. PHP从5.2.x它与OSX狮子捆绑5.4.x版本升级。

  2. 我不得不通过安装 Zend服务器,拿起ZendDebugger获得Zend调试为PHP 5.4。所以和卸载Zend服务器(这一切都是因为Zend公司没有提供自己的调试器PHP 5.4.x版本的单机版)。

于是乎,我也许以后加载和重新加载网站的几个时间让这个问题。此错误发生后,我的Web服务器返回保持了同样的错误托管在localhost上任何其他应用程序。我不得不提的是静态的网页供应罚款。

我见过几个<一个href=\"https://www.google.co.in/#q=failed%20to%20open%20stream%20too%20many%20open%20files%20php\">threads关于这一主题。多数指出到文件句柄没有被正确关闭,从而穿越打开文件限制阈值code的问题。我还发现这似乎在暗示这可能是一个Zend调试问题,这线程。还有申请PHP 5.2.x.一个 bug报告这里继线程,我试过如下:

  $的ulimit -a

这报道:

 打开文件(-n)256

此外,

 的sysctl -a | grep的文件

回报,

  kern.maxfiles = 12288
kern.maxfilesperproc = 10240
kern.maxfiles:12288
kern.maxfilesperproc:10240
kern.num_files:3248

另一个有趣的线程建议使用来提高这个限制(目前为256)

 的ulimit -n 1024

我已经尝试了一切,但似乎没有奏效。问题也没有一致地重现。

我用疑惑的ulimit -n 1024 会影响到Apache的,因为从我读过,它影响到的文件外壳的数量可以打开。

任何帮助是AP preciated。

编辑:


  1. 重新启动阿帕奇帮助了一会儿,直到再次遇到错误。

  2. 离开Web服务器闲置位(没有明确的间隔)也有帮助。


解决方案

我可能是从信息超载的痛苦。一种可能的解释是提供这里这我也提到我原来的职位。我想我错过了小细节,其中OP提到,他的工作在Mac OSX 10.8.x.我在10.9于是我下载了zenddebugger.so从页面,事情正在寻找好的。还没有得到一个打开的文件太多一整天。

所以,也许这是一个ZendDebugger问题。

I've recently upgraded to OSX Mavericks and since then, I've started getting the aforementioned error on my development machine. There is no obvious problem in the code (it's an auto generated Yii sample application). What has happened as part of upgrade to Mavericks is:

  1. PHP was upgraded from 5.2.x which bundled with OSX Lion to 5.4.x.
  2. I had to get a Zend Debugger for PHP 5.4 by installing Zend Server, picking up the ZendDebugger.so and uninstalling the Zend Server (all this because Zend doesn't provide a standalone version of their debugger for php 5.4.x).

Ever since, I'm getting this problem after maybe loading and reloading the website a few time. After this error occurs, my web server keeps returning the same error for any other application hosted on localhost. I have to mention that static web pages are served up fine.

I've seen several threads on this topic. Most point out to issues in code where file handles are not being closed properly, thereby crossing the open file limit threshold. I also found this thread which seems to suggest this might be a zend debugger issue. There's also a bug report filed for php 5.2.x. Following the thread here, I tried the following:

$ ulimit -a

which reports:

open files (-n) 256

Also,

sysctl -a | grep files

returns,

kern.maxfiles = 12288
kern.maxfilesperproc = 10240
kern.maxfiles: 12288
kern.maxfilesperproc: 10240
kern.num_files: 3248

Another interesting thread suggests to raise this limit (currently 256) using:

ulimit -n 1024

I've tried everything, but nothing seems to be working. The problem is also not consistently reproducible.

I am wondering is using ulimit -n 1024 is going to affect apache, since from what I've read, it affects the number of files shell can have open.

Any help is appreciated.

EDIT:

  1. Restarting apache helps for a bit, till the error is encountered again.
  2. Leaving the web server idle for a bit (no definite interval) also helps.

解决方案

I was probably suffering from information overload. A possible explanation is offered here which I've also mentioned in my original post. I guess I missed the little detail where the OP mentions that he's working on Mac OSX 10.8.x. I'm on 10.9 so I downloaded the zenddebugger.so from the page and things are looking good. Haven't gotten a single too many open files all day.

So, perhaps it was a ZendDebugger issue.

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

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