简体   繁体   English

PHP错误抑制被忽略

[英]PHP error suppression is being ignored

My current php.ini file is set to report all errors other than deprecation and strict standards as follows: 我当前的php.ini文件设置为报告除弃用和严格标准以外的所有错误,如下所示:

error_reporting = E_ALL & ~E_STRICT & ~E_DEPRECATED

The reason for using this setting is that we urgently need to perform a PHP upgrade on the linux server hosting our websites; 使用此设置的原因是我们迫切需要在托管我们网站的Linux服务器上执行PHP升级; the problem there being that deprecated functions and strict standards recommendations will very quickly fill up error log files for over 170 websites. 问题是,已弃用的功能和严格的标准建议将很快填满170多个网站的错误日志文件。 The errors are mostly due to small things like functions not being declared as static, etc. Eventually we will get through all the sites and fix those problems, however in the meantime we need to suppress the errors. 这些错误主要是由于函数没有声明为静态等等。最终我们将通过所有站点并修复这些问题,但与此同时我们需要抑制错误。

The problem I'm having on a local test environment (running the version of PHP we are looking to upgrade to - 5.4.3) is that the errors still display with the following printed before: 我在本地测试环境中遇到的问题(运行我们希望升级到的PHP版本 - 5.4.3)是错误仍然显示以下打印之前:

SCREAM: Error suppression ignored for

Can anyone give me some insight into why the error suppression is being ignored and how to properly suppress the errors? 任何人都可以让我深入了解为什么忽略错误抑制以及如何正确地抑制错误?

Thanks in advance. 提前致谢。

It seems that you are using the scream extension. 看来你正在使用尖叫扩展。 From the manual: 从手册:

The scream extension gives the possibility to disable the silencing error control operator so all errors are being reported. 尖叫扩展可以禁用静默错误控制操作符,以便报告所有错误。 This feature is controlled by an ini setting. 此功能由ini设置控制。

Scream is an extension for debugging that aims to display as many error messages as possible. Scream是调试的扩展,旨在显示尽可能多的错误消息。 This is done by ignoring the @ operator and always having the highest error_reporating level available. 这是通过忽略@运算符并始终具有最高的error_reporating级别来完成的。 (regardless of your error_reporting setting). (无论您的error_reporting设置如何)。 So you will have to deactivate the extension in your php.ini: 所以你必须在你的php.ini中停用扩展名:

scream.enabled = off

BTW: I would not update a server having 170 websites with code errors. 顺便说一句:我不会更新有170个代码错误的网站的服务器。 It's a ticking bomb now. 现在这是一颗定时炸弹。 It would be better to migrate them site by site to the new PHP version. 最好将它们逐站点迁移到新的PHP版本。 Maybe having two servers parallel during the migration process. 在迁移过程中可能有两台服务器并行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM