Can I disable PHP errors?

August 27, 2011     0 comments

Yes, you can, either by placing this code on the top of every page:

<?php error_reporting(0); ?>

Or in a .htaccess file, using:

<IfModule mod_php5.c>
  php_value error_reporting(0);
</IfModule>


You can have various other error reporting, these include:

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized variables or catch variable
//name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE.  This is the default value set
error_reporting(E_ALL ^ E_NOTICE);

// Report all PHP errors (see changelog)
error_reporting(E_ALL);

// Report all PHP errors
error_reporting(-1);

How helpful was this article to you?

FraudLabs Pro Secured Seal