PHP APC:使用前一个请求的包含路径而不是当前的路径
由于某种原因,我的类未正确加载。它们要么无法加载,要么加载了错误版本的类(从错误的目录获取)。
经过一些调试后,很明显,使用的包含路径实际上是前一个请求的包含路径。
但是,当我运行 get_include_path() 时,记录的结果是正确的,但从行为中可以清楚地看出,实际上它没有被使用,而是使用了上一个请求中的路径。
我的代码是带有 Yii 框架的 PHP。框架在运行时操作includepath
。
PHP 版本是 5.31
,xampp,windows7
编辑:禁用 apc 解决了问题
For some reason my classes are not loaded correctly. They are either failing to load, or the wrong version of the class is loaded (taken from the wrong directory).
After some debugging, it became apparent that the include path that is used is in fact the include path from the previous request.
However, when I run get_include_path()
the logged result is correct, but it's clear from the behavior that in practice it's not used, and instead used the path from the previous request.
My code is PHP with the Yii framework. The framework manipulates includepath
at runtime.
PHP versions is 5.31
, xampp, windows7
edit: disabling apc solved the problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 APC 上经常看到这种情况。最常见的是,当 APC 装满时。
运行 apc.php< /a> 脚本(包含在大多数 APC 安装中)在浏览器中检查您的利用率。输出看起来像这样:
如果 APC 已满,请增加分配给它的内存量。在 PHP 配置中的某个位置,有一个配置选项控制此操作:
apc.shm_size=64
。这会分配 64 兆内存。增加它直到你有一些喘息的空间。您需要重新启动 apache 才能使此更改生效。如果您每次都将应用程序部署到磁盘上的不同路径,则可能应该清除 APC——否则旧的缓存条目往往会持续存在。最简单的方法是优雅地重新启动您的网络服务器。请注意,在活动的生产服务器上,这将中断活动请求一秒钟左右。
I see this pretty regularly with APC. Most often, when APC fills up.
Run the apc.php script (included with most APC installs) in your browser to check your utilization. Ouput looks like this:
If APC is full, increase the amount of memory allocated to it. Somewhere in your PHP config, there's a config option controlling this:
apc.shm_size=64
. This allocates 64 meg of ram. Increase it until you have some breathing room. You'll need to restart apache for this change to take effect.If you deploy your application to a different path on disk every time, you should probably purge APC -- otherwise the old cache entries tend to linger. The easiest way to do this is with a graceful restart of your webserver. Note that on an active production server, this will interrupt active requests for a second or so.