Yet regardless of the source of the error, your application
must be able to encounter and react to such unexpected errors in a graceful fashion,
hopefully doing so without losing data or crashing the application. In addition, your
application should be able to provide users with the feedback necessary to understand
the reason for such errors and potentially adjust their behavior accordingly.
This chapter introduces several features PHP has to offer for handling errors.
Specifically, the following topics are covered:
Configuration directives: PHP??™s error-related configuration directives determine
the bulk of the language??™s error-handling behavior. Many of the most pertinent
directives are introduced in this chapter.
Error logging: Keeping a running log is the best way to record progress regarding
the correction of repeated errors, as well as quickly identify newly introduced
problems. In this chapter, you learn how to log messages to both your operating
system syslog and a custom log file.
Exception handling: Prevalent among many popular languages (Java, C#, and
Python, to name a few), exception handling was added to PHP with the version 5
release. Exception handling offers a standardized process for detecting, responding
to, and reporting errors.
214 CHAPTER 8 ?– ERRO R AND EXCEPTION HANDL ING
Historically, the development community has been notoriously lax in implementing
proper application error handling.
Pages:
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290