php hide ALL errors php hide ALL errors apache apache

php hide ALL errors


to Hide All Errors:

error_reporting(0);ini_set('display_errors', 0);

to Show All Errors:

error_reporting(E_ALL);ini_set('display_errors', 1);


Per the PHP documentation, put this at the top of your php scripts:

<?php error_reporting(0); ?>

http://php.net/manual/en/function.error-reporting.php

If you do hide your errors, which you should in a live environment, make sure that you are logging any errors somewhere. How to log errors and warnings into a file? Otherwise, things will go wrong and you will have no idea why.


In your php file just enter this code:

error_reporting(0);

This will report no errors to the user. If you somehow want, then just comment this.