Web Development Blog

by Ei Sabai Nyo

21 Jun, 2007

Error logging in PHP    

One of the most important tasks of any developer is to know what errors occur in his application, because it is impossible to fix them if you don’t know if they exist in the first place. Although you may think that your application is perfect and bugs free, you can never be 100% sure because users might not operate the application in the way you expect them to. And this is when error logging come in, where you record any errors that users encounter in a log file which can be used to improve your application. In PHP, you can control how errors are handled and reported. The following is an example of how errors may be logged:


// Error Reporting settings
ini_set('error_reporting', E_ALL ^ E_NOTICE); // log all errors except notices
ini_set('log_errors', true); // enable error logging
ini_set('html_errors', false); // disable html errors
ini_set('error_log', '/home/directory/to/your/error_log.txt'); // save all the errors to a log file
ini_set('display_errors', true); // do not display errors on screen

Related articles:

Technorati Tags: , , ,

Love what you've just read? Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
Your name:   Your email:  

Comments are closed.

Profile PicHello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more about me or have a look at some of the tips & resources I've written.
Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
We do NOT spam.
Your name:  
Your email:  

Tips & Resources

Tips & Resources
WordPress Web Hosting
Recommended web hosting providers for WordPress 3.0
iPhone Native App Development
Important steps into iPhone app development for beginners
iPhone Web App Development
Tips for iPhone web app development
Coupons for Web Developers
Get discounts on web hosting, domain names, templates, etc
10 Useful jQuery Snippets
Easy-to-use jQuery snippets for any website
HTML Email Newsletter
Step-by-step tutorial on how to code an HTML email newsletter
  • bluehost Hosting $6.95/month
  • Joomla Templates

Recommended Book

Categories