PHP
  Home arrow PHP arrow Page 7 - Error Handling In PHP (part 2)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Error Handling In PHP (part 2)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 10
    2002-04-09


    Table of Contents:
  • Error Handling In PHP (part 2)
  • Raising Hell
  • Rolling Back
  • Turning Up The Heat
  • Of Form And Function
  • Buffer Zone
  • Back To Class
  • Endgame

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Error Handling In PHP (part 2) - Back To Class
    ( Page 7 of 8 )

    If you're not a big fan of rolling your own code, you might find it instructive and useful to download the free, open-source ErrorHandler class from http://www.phpclasses.org/browse.html/package/345. Created by Gyozo Papp, this PHP class is a robust, full-featured error handler that can easily be integrated into your application code.

    The ErrorHandler class comes with some very interesting features: the ability to dump errors to a separate console window so that your primary interface is not disrupted, to include in that error report the source code which caused the error, and to append customized error messages or variable context to the error report. Obviously, it also supports error logging (to a file, an email message, the system logger, or all three) and can catch and replace PHP's error messages with a user-defined error template.

    Here's a small example of how it works - take a look at the manual included with the class for more examples and information.

    report_layout('LOGGING', FILE_LOG, 'error.log'); // don't display symbol table $error->report_layout('CONTEXT', FALSE); // uncomment this to hide errors and display a customized error template // $error->set_silent(TRUE); // $error->set_silent("error.html"); // generate some errors include('non.existent.file'); mysql_connect("localhost", "baduser", "badpassword"); ?>
    And here's what it looks like:



     
     
    >>> More PHP Articles          >>> More By icarus, (c) Melonfire
     

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT