Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Fatal Error Handling, Logging, Security



9:45 am on Apr 3, 2008 (gmt 0)

5+ Year Member

in PHP I under stand warning and notices. They end up in log file. FATAL ERRORS....confuse me a bit.

A FATAL ERROR will stop execution on the spot. Something like a missing file in a Require(donotexist.php) or a call to an undefined Function.

Where do this get logged to? Do they? There a nice way to handle this? I see that FATAL ERRORS give away too much information on the screen.



3:01 pm on Apr 3, 2008 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

error_reporting [php.net] will get you started off in the right direction. Read that page as well as the linked pages regarding the other directives in PHP for handling errors. The biggest questions to answer are "What errors should I be reporting?" and "What method should I use to report them?"

More often than not you will want to report all your errors as this will help you determine where you have issues. How you report them is where the difference comes into play. In your development environment, you may want to log the errors, or you may want to display them in your browser, or both! Both is sometimes a good thing as you may have markup on your page that covers up the error being displayed on the screen. Whatever you decide, be sure to be monitoring errors in your development environment.

Now, on your production box you will want to be sure that you are not displaying errors in the browser! You will log them but it is not wise, nor a good user experience, if you are dumping errors to the browser. Where do they get logged? There is a directive on the page mentioned that explains your options.


Featured Threads

Hot Threads This Week

Hot Threads This Month