Solved

Error Handling in PHP - set_error_handler("customError") $error_types

Posted on 2009-03-30
2
381 Views
Last Modified: 2013-12-13
How to use $error_types custom errors? Right now I am getting all the warnings/errors, I just want to see ONLY errors. How do I restrict my errors/warnings to ONLY E_ERROR? I want to avoid all rest of the warnings etc...

I have attached the code.
Thanks.



function customError($errno, $errstr, $errfile, $errline){ 
	//My code to send an email when error occurs
 }
//set error handler
set_error_handler("customError");

Open in new window

0
Comment
Question by:martyje
2 Comments
 
LVL 17

Accepted Solution

by:
Chris Harte earned 500 total points
ID: 24020126
This should do it.
//set error handler
error_reporting (E_ERROR);
ini_set ('display_errors', '1');
 
function customError($errno, $errstr, $errfile, $errline)
{ 
        //My code to send an email when error occurs
}

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question