Hide PHP errors using htaccess

By default, the PHP display_errors setting is set on. You can read more about display_errors at PHP: Error Handling and Logging Functions. There are few important things that you should know about the error messages that is sent to the browser by display_errors.

Usually these error messages contains sensitive information about the web application environment that you are running and could lead to unwanted security threat. It is even stated in the manual that it is not recommended to enable this feature on a production site.

To disable or switch it off (assuming that you’re on a shared hosting which have limited super power), simply add php_flag display_errors off in your .htaccess file.

Leave a Reply