我们本周在生产中部署了我们的第一个Symfony2网站。
奇怪的事情在服务器上开始发生,但我们无法在本地重现问题。我们在其他服务器上测试过并发现了同样的错误。如果它有帮助我们在亚马逊ec2和其他服务器上的debian上尝试了ubuntu ami。还有apache2 + mod_php和nginx + php-fpm,php版本是5.3.3。 Symfony是2.0.9。
有些请求只返回空白屏幕,错误日志出现在错误之后:
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php on line 80
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 1152
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 1146
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 464
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 465
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 466
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 666
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 467
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 468
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/app/bootstrap.php.cache on line 469
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php on line 34
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/Request.php on line 123
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php on line 34
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/Request.php on line 124
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php on line 34
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/Request.php on line 125
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php on line 34
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/Request.php on line 126
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/FileBag.php on line 48
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/Request.php on line 127
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/ParameterBag.php on line 34
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Warning: Attempt to assign property of non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/Request.php on line 128
[Sun Feb 12 17:09:30 2012] [error] [client 192.168.51.125] PHP Fatal error: Call to a member function getHeaders() on a non-object in /var/www/itop/vendor/symfony/src/Symfony/Component/HttpFoundation/Request.php on line 129
我们真的被困在试图找出问题还有其他人遇到过这种问题吗?任何帮助将不胜感激。
答案 0 :(得分:1)
根据我的经验,当你有这样的奇怪错误时,特别是当你在非感性的地方看到随机的“非对象”问题时,问题总是记忆。从字面上看,正在创建一个对象,但随后该对象在内存中丢失,因此在下一行中,它不再是一个对象。我只看过几次,但它一直与APC的问题有关。事实上,在我上一份工作中,我们在升级到PHP 5.3之后遇到了类似的问题 - 它大部分时间都可以工作,但是APC最终会耗尽内存而我们会得到这些错误。当时(大约一年前),似乎(来自谷歌搜索)在某些情况下PHP和APC存在一些问题。我肯定会研究APC - 我真的认为这是你的问题。具体来说,APC并没有冲洗旧记忆,为新事物腾出空间。
祝你好运!答案 1 :(得分:1)
好的,我认为我们找到了解决这个问题的方法。当我们将服务器上的php升级到最新版本时,奇怪的错误消失了:5.3.10。就这么简单。可能是php 5.3.3的一些bug,我不知道。我们在更改日志中找不到任何相关内容。
本周末,我们将使用freebsd和5.3.8测试另一台机器。
感谢所有试图提供帮助的人。
答案 2 :(得分:0)
您是否尝试升级到Symfony 2.0.10?