The Wicked Coder

PHP, fun and all

Hide PHP errors via .htaccess or PHP code

By default, the PHP display_errors set­ting is set on. You can read more about display_errors at PHP: Error Han­dling and Log­ging Func­tions. There are few impor­tant things that you should know about the error mes­sages that is sent to the browser by display_errors.

Usu­ally these error mes­sages con­tains sen­si­tive infor­ma­tion about the web appli­ca­tion envi­ron­ment that you are run­ning and could lead to unwanted secu­rity threat. It is even stated in the man­ual that it is not rec­om­mended to enable this fea­ture on a pro­duc­tion site.

To dis­able or switch it off (assum­ing that you’re on a shared host­ing which have lim­ited super power), sim­ply add php_flag display_errors off in your .htac­cess file.

 

If you dont have access to .htaccess file or having trouble editing it, there is a simple solution. Just add


Updated: June 30, 2013 — 4:10 am
The Wicked Coder © 2014