Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 11th, 2004, 07:05 PM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 - Reporting Fatal Errors

I would like to implement the PHP Error Handler from Chapter 8 into my website, but have been unable to get the script to work when it encounters a fatal error. The problem I have been experiencing, both locally and on my remote server, is that when PHP encounters a fatal error, it appears to stop all scripts.

I have researched elsewhere and have been unable to find any reference of PHP still executing a script after it has encountered a fatal error. I have even copied the source from www.wrox.com and placed it on my site, but still receive the same problem.

Any assistance would be greatly appreciated. Both my server and my development machine are running PHP 4.3.8. Below is my source code, in case it helps. Thanks.

--------------------------------------------------------------
function handler($error_type, $error_message, $error_file, $error_line)
{
  switch($error_type)
  {
   //fatal error
   case E_ERROR:
     echo 'Hello World';
     // send mail
     $subject = $error_type . ' on line ' . $error_line . ' in ' . $error_file;
     $content = "MY EMAIL CONTENT";
     from = 'Fatal Error @ BW';
     developerMail($subject,$content,$from);
     die();
     break;
     //end script

   case E_WARNING:
     // send mail
     $subject = $error_type . ' on line ' . $error_line . ' in ' . $error_file;
     $content = "MY EMAIL CONTENT";
     $from = 'Warning @ BW';
     developerMail($subject,$content,$from);
     break;
     //script will continue

   case E_NOTICE:
     //don't show notice errors
     break;
  }
}
error_reporting(0);
set_error_handler("handler");

//cause a fatal error
fatalerror();
--------------------------------------------------------------
NOTE—The script does work when it encounters a warning. My only problem is with fatal errors. Thanks again.


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
More Errors in chapter 7..... rollercoaster BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 5 October 3rd, 2006 03:49 PM
Chapter 4 Example Code Errors beckerm13 BOOK: Professional Ajax ISBN: 978-0-471-77778-6 3 September 28th, 2006 03:40 PM
Chapter 6 Try It Out errors Voltron ASP.NET 2.0 Basics 0 August 9th, 2006 01:42 AM
Chapter 4 Errors? DRAYKKO BOOK: Beginning Java 2 3 June 1st, 2004 07:47 AM



All times are GMT -4. The time now is 05:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.