Error Reporting in PHP

error reporting in php

Basically when our application is LIVE then we don’t want to show any error/warning on the screen if it will show on the screen it will make a bad impression in front of a client and we doesn’t want to loose our credibility at any cost.

So we need to disable the errors showing on the screen of a user and need to logged those errors/warnings information so that we will know and rectify it.

PHP error reporting feature will help us to identify those mistakes so that we will be able to rectify it.

For this we need to make setting display_errors to Off and log_errors to On and need to set the location for log errors file.

PHP allows to set own way of of handling errors using set_error_handler() function

In the above code section, my_error_handler is the own written function to handle my customised errors.In the below section, we will implement like this:

Leave a Comment

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

Optimization WordPress Plugins & Solutions by W3 EDGE