来自运行多个虚拟主机的Zend Framework的Apache的间歇性500错误 [英] Intermittent 500 errors from Apache running Zend Framework with multiple virtual hosts

查看:115
本文介绍了来自运行多个虚拟主机的Zend Framework的Apache的间歇性500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经在一个项目上进行了几个月的工作,直到最近的更新为止。该服务器运行的是Amazon Linux AMI版本2010.11.1,以及Apache 2.2.16和PHP 5.3.3。该项目分为几个独立的开发人员分支,它们作为虚拟主机运行,每个分支都有包括Zend Framework 1.11.3在内的所有代码的完全独立的副本。该项目还包括Doctrine 2.0.1,但我认为这不是问题所在。我过去曾尝试过APC,但现在还没有安装它。当多个用户跨不同分支访问服务器时,此问题似乎最常发生。我怀疑该问题可能与Zend Framework引导过程中所需的某些核心类的版本不同有关,但是我无法弄清楚根本原因是什么。我们尝试从git repo强制所有分支使用相同版本,然后重新启动Apache。这可以暂时解决问题,但很快就会恢复。一切始于一周前,当时我只为Linux,PHP和Zend Framework安装了一组主流更新。发生问题时,它甚至会传播到我们的phpmyadmin虚拟主机中,该虚拟主机甚至与Zend Framework没有任何关系。我感到难过。以下是我们在Apache日志中看到的一系列错误:

We have been working on a project for several months without any problems until a set of recent updates. The server is running Amazon Linux AMI release 2010.11.1, with Apache 2.2.16 and PHP 5.3.3. The project is divided into a few separate developer branches, running as virtual hosts, each with a completely separate copy of all the code including Zend Framework 1.11.3. The project also includes Doctrine 2.0.1, but I don't think that is where the problem is. I have experimented with APC in the past, but I don't even have it installed right now. The issue seems to occur the most when multiple users are hitting the server across different branches. I suspect that the issue could be related to differing versions of certain core classes that are required during the Zend Framework bootstrap process, but I can't figure out what the root cause is. We have tried forcing all the branches to be at the same version from our git repo, and then restarted Apache. This temporarily resolves the issue, but it soon returns. It all began a week ago when I merely installed a set of mainstream updates for Linux, PHP, and Zend Framework. When the issue is occurring, it even propagates into our phpmyadmin virtual host, which doesn't even have anything to do with Zend Framework. I am stumped. Following is the set of errors we see in the Apache log:

[Wed Mar 02 20:32:40 2011] [error] [client 127.0.0.1] PHP Warning:  array_keys() expects parameter 1 to be array, null given in /var/www/dev/library/Zend/Loader/Autoloader.php on line 251, referer: https://foo.bar/admin/asset_manage/search
[Wed Mar 02 20:32:40 2011] [error] [client 127.0.0.1] PHP Warning:  Invalid argument supplied for foreach() in /var/www/dev/library/Zend/Loader/Autoloader.php on line 345, referer: https://foo.bar/admin/asset_manage/search
[Wed Mar 02 20:32:40 2011] [error] [client 127.0.0.1] PHP Warning:  array_key_exists() expects parameter 2 to be array, null given in /var/www/dev/library/Zend/Loader/Autoloader.php on line 194, referer: https://foo.bar/admin/asset_manage/search
[Wed Mar 02 20:32:40 2011] [error] [client 127.0.0.1] PHP Fatal error:  Class 'Zend_Config_Ini' not found in /var/www/dev/library/Zend/Application.php on line 383, referer: https://foo.bar/admin/asset_manage/search


推荐答案

这个问题,原来是问题是由PHP realpath_cache的行为变化引起的。当我在php.ini中设置 realpath_cache_ttl = 0 时,类加载不正确的问题就消失了。

Well, after much agony over this issue, it turns out the problem was caused by a change in the behavior of the php realpath_cache. When I set realpath_cache_ttl = 0 in my php.ini, the issue with the improperly loading classes goes away.

我不确定这些更新是如何引入的,但是我认为开发箱不需要缓存,因此这使我重回正轨。在生产服务器上,无论如何,每个Apache服务器上都应该只运行一个应用程序实例(没有虚拟主机),因此在这种情况下我可能可以使用缓存。

I am not sure how this got introduced in these updates, but I don't think the cache is required on a dev box, so this gets me back on track. On a production server, I should only have one instance of the app running per Apache server anyway (no virtual hosts), so I could probably use the cache in that scenario.

如果有人对realpath_cache问题的原因有其他了解,我也不会介意。

If anyone has any additional insight into the cause of the realpath_cache issue, I wouldn't mind hearing it.

这篇关于来自运行多个虚拟主机的Zend Framework的Apache的间歇性500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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