Tuesday, July 8, 2008

How to turn off error reporting in php Using php code - error_reporting()

If you want to turn off any errors and warning from displaying in the web page, The easiest way is to modify the php.ini file.
But what if you want to turn off error reporting in php using your php code? you can accomplish this easily using php built in function error_reporting()


error_reporting(0); // Turn off all error reporting


More info : http://www.php.net/error_reporting

Freelance Jobs


  1. Thanks. small piece of code, which I keep forgetting :P

  2. Thanks a ton, use it :)

  3. This is a very cool trick for those who don't have access to the php.ini file their Web host service provides. Error codes not only look ugly, but in some cases may provide too much information for the opportunistic injector to break past your site security.

    Many thanks!

  4. It doesn't work. Have it in my index.php but not working.
    Do I need to reboot server? Meh.