Solved

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

Posted on 2009-03-30
2
374 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 16

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now