Search code examples
phperror-handlingdeprecated

How can I remove deprecated messages from error reporting in php?


This is my php file:

<?php
error_reporting(E_ALL ^ E_DEPRECATED); ini_set('display_errors', '1');

here my .htaccess:

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag  log_errors on

Still I see the deprecated messages on my page. How can I remove them?


Solution

  • Your given code removes only deprecated messages wich are emitted at run-time.

    However, many deprecated messages are emitted at compile-time. These messages can only be hidden by updating the error_reporting value in your php.ini file.

    With the following php.ini setting, you can hide deprecated messages by default:

    error_reporting = E_ALL & ~E_DEPRECATED