Specifications

FIGURE 23.1
You can give friendlier error messages than PHP if you use your own error handler.
This custom error handler does not do any more than the default behavior. Because this code
is written by you, you can make it do anything. It gives you a choice about what to tell your
visitors when something goes wrong and how to present that information so that it fits the
rest of the site. More importantly, it gives you flexibility to decide what happens. Should the
script continue? Should a message be logged or displayed? Should tech support be alerted
automatically?
It is important to note that your error handler will not have the responsibility for dealing with
all error types. Some errors, such as parse errors and fatal runtime errors will still trigger the
default behavior. If this concerns you, make sure that you check parameters carefully before
passing them to a function that can generate fatal errors and trigger your own E_USER_ERROR
level error if your parameters are going to cause failure.
Remote Debugging
Version 3 of PHP included a remote debugger. The purpose of this was to send detailed infor-
mation about errors and events while your code executed to a port that could be monitored.
This functionality is not available in PHP version 4 without purchasing the Zend IDE.
Building Practical PHP and MySQL Projects
P
ART V
494
29 7842 CH23 3/6/01 3:41 PM Page 494