Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-03-30
2
Medium Priority
?
407 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
Chris Harte earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 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