Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Ignore Errors PHP


#1

Hi

We currently have a lot of wordpress sites that we monitor in production environments. One of the issues we have is that there are a lot of warnings being reported to new relic as errors and going into each site to change the settings isn’t really practical.

I was trying to use the ignore errors setting

newrelic.error_collector.ignore_errors = “E_WARNING”

The setting shows up fine in phpinfo on the sites but the warnings are still being reported to NewRelic.

How can I avoid this?

As this is a production server we only want fatal’s being alerted back to the ops teams.

Thanks


#2

Hi @parvez - Looks like this question has been asked and answered before. Have a look to see if this helps you.


#3

Hi @stefan_garnham thats a slightly different approach and I think it was the right solution before newrelic introduced the ability to control this from newrelic. I still want warnings to be thrown in the application, as we need the information to debug issues etc. But I dont want newrelic to treat them as actual errors and that was my understanding of the purpose of the newrelic.error_collector.ignore_errors directive.

According to the docs this approach should work

https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-configuration#inivar-err-ignore-errors


#4

We actually use the same syntax as the core PHP error setting so it’ll look similar like this:

newrelic.error_collector.ignore_errors = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING

Per the doc you linked to “This uses the same error syntax as PHP’s error_reporting option”


#5

But in the case of error_reporting, you’re actually telling it which errors you want to see. In this case, aren’t you telling it which errors you don’t want to see? Because the way the directive is phrased is “ignore_errors”, one would think you’re supposed to list the errors to ignore.

So if I list out E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING, Am I telling it to ignore all errors except E_NOTICE, E_STRICT, etc? Or am I telling it to pay attention to all errors except E_NOTICE, E_STRICT, etc?


#6

Sorry for the confusion, you are correct. For PHP error reporting, if you don’t want to see E_WARNING you would use

error_reporting = E_ALL & ~E_WARNING

But if you don’t want to see them in New Relic you would use

newrelic.error_collector.ignore_errors = E_WARNING

We are looking into updating the documentation around this setting both in our docs and within the newrelic.ini files.