Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best practices for PHP error handling

Status
Not open for further replies.

awaresoft

Programmer
Feb 16, 2002
373
DE
Newbie to PHP trying to build a simple, generic framework for a simple website. Looking for simple best practices for PHP error handling.

My research indicates that I should do the following.

In my local php.ini file:

display_errors = Off
error_log = error_log // should I change this?
error_reporting = 2039
log_errors = On

As for coding I should:

1. Use ob_start() to cache output (in case I need to clear it when an error occurs)

2. Trap errors by setting a custom error handler via set_error_handler()

3. In the case of unrecoverable errors redirect to a generic error page?

Any other advice or code snippets?

Thanks!
Malcolm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top