Modifying PHP Error Reporting Levels Print

  • 4

 

Modifying PHP Error Reporting Levels

To manage the error messages generated by PHP, you can modify the php.ini file corresponding to the PHP version in use. This allows you to control which errors are displayed or logged.

 

Recommended Configuration

Add or update the following directive in the php.ini file:

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED

 

Parameter Meaning

  • E_ALL: enables reporting of all types of errors.
  • ~E_NOTICE: excludes less important notices.
  • ~E_WARNING: excludes warnings (non-critical alerts).
  • ~E_DEPRECATED: excludes messages about deprecated functions.

This configuration allows only the most relevant errors to be reported, avoiding unnecessary messages that may be distracting during development.

 

Note

After modifying php.ini, you must restart Apache or PHP-FPM for the changes to take effect.

 


Was this answer helpful?

« Back