Control PHP Error Reporting With .htaccess

Create .htaccess file or use existing .htaccess file in your hosting site. Add below line at the top of file content.
[sourcecode language=’php’] # to stop php startup errors
php_flag display_startup_errors off
# to stop all php errors and warning
php_flag display_errors off
[/sourcecode] You can also control level of error reporting. Here is the .htaccess syntax:
[sourcecode language=’php’] # php directive for setting error level
php_value error_reporting integer
[/sourcecode] Example:
[sourcecode language=’php’] # report everything except run-time notices.
php_value error_reporting 8191
# report both fatal and non-fatal compile-time warnings by the Zend Engine
php_value error_reporting 128
# report run-time notices, compile-time parse errors, run-time errors and warnings
php_value error_reporting 8
# report fatal run-time errors and unrecoverable errors
php_value error_reporting 1
[/sourcecode]

Written by Bala Krishna

I have high-class programming talent, and the able to work efficiently with international time zones. Outsource your web and software development project to us and get access to some of the best expertise and talent in IT industry. I offer flexible and affordable solution depending upon your project needs. You outsource your coding assignment to us and we finish it on time at a specific cost.

This article has 3 comments

  1. Ed Braim

    I am not new to blogging and truly value your site. There is much innovative subject that peaks my interest. I am going to bookmark your web site and keep checking you out.

  2. Martyn

    Hello..
    How not to display any notices and display the rest?

    php_value error_reporting 8191 does show notices.

  3. Anirudh

    I’m with Martyn, how do you do: error_reporting(E_ALL ^ E_NOTICE); ???

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>