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]



Rate this Post:

Read Related Post

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply

You must be logged in to post a comment.



|