[thelist] PHP's include() function

Hans Zaunere zaunere at yahoo.com
Wed May 29 16:11:01 CDT 2002


> In using the die() function, it displays the message inside
> of it and stops all PHP processing instead of displaying a
> really ugly, unprofessional PHP error.

This is not professional either.  You need to look at PHP error
handling (http://www.php.net/manual/en/features.error-handling.php) and
functions (http://www.php.net/manual/en/ref.errorfunc.php).

One way of doing this, is to setup an error handler function
(set_error_handler()).  Then, when you call trigger_error('OH NO, my
database!', E_USER_ERROR); you can deal with it accordingly (ie,
redirect to a proper page, while logging what really happened -
error_reporting(), error_log(), and a couple php.ini/ini_set()
directives as well).

> But since that die() function has stopped the PHP
> processing, my footer file is not included at the bottom of
> the page like I need it to be.

Exactly.  I only use die/exit in development.  Then when we go
production, I drop an error handling scheme in.

> There must be some kind of workaround or alternate function
> to die() or exit().  I'm sure someone else has had this
> problem in the past... could you please help me?

Error handling is easy... try dealing with auditing every
change/update/view for who/when/where so that you're compliant with
medical record laws.

Hans Z.
New York PHP
http://nyphp.org



__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the thelist mailing list