• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

PHP agent not reporting errors

Problem

Errors in your application aren't reported or captured by the PHP agent as expected.

Solution

If you are using a third party error handler (for example: XDebug or Laravel's error handler):

  1. Disable the third party error handler.
  2. Confirm the errors are reporting by viewing the APM errors page.

If you are not using a third party error handler, but you still do not see expected errors (for example: 404 errors):

  1. Ensure PHP is handling the error, because New Relic cannot report errors that are not recognized by PHP (such as 404 errors for static assets on the web server).
  2. Manually instrument the error you are expecting to see by using the newrelic_notice_error() API call.
  3. Confirm the errors are reporting by viewing the APM errors page.

Cause

PHP handles errors with its own default handler. Many third party handlers, such as XDebug or Laravel's error handler, often override PHP's default handler and capture the error instead of PHP.

The PHP agent has its own error handler that relies on PHP capturing the error. Since only one handler can handle an error, the agent does not see errors that were already handled by the third party handler before it could get captured by PHP.

Additionally, some errors (for example: 404 errors) often occur at the web server level, which means that PHP is never involved and the error is never captured by the agent. If PHP is used to handle 404 errors, use the newrelic_notice_error() API call to manually instrument those errors.

Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.