Chapter 11: Debugging Your Code

Chapter 11 - Debugging Your Code
byGareth Downes-Powellet al.
Wrox Press 2003

Overview

Author: Gareth Downes-Powell

  • PHP error types

  • Desbugging techniques

  • Where to get help

This chapter explains ways of debugging, or finding errors, in your code. We start by discussing error handling in PHP, looking at the types of errors that can occur. We then create a custom error handler, so that we can present a professional and helpful message to the user if an error occurs, instead of showing the default PHP error message.

We then look at how to view your server settings, and see which libraries, etc. have been installed. Next, we create a custom debug function, which can print details of your variables, so you can track them through your code.

In the last section of this chapter, we look at the ways of getting help that are available on the Internet, giving details of web sites, newsgroups, and forums that can help you to quickly solve your problems.

If you've been following the examples from the book so far in Dreamweaver MX, it's more than likely that you've already had to debug your code. In this chapter we're going to be looking at various ways to make finding errors in your code easier.

PHP in general is quite good at giving an accurate error message, giving you the precise line number of the code that contains the error. Unfortunately this isn't always totally reliable, as we'll explain later, and we look at ways of tracking down different errors.



Dreamweaver MX PHP Web Development
Dreamweaver Mx: Advanced Php Web Development
ISBN: 1904151191
EAN: 2147483647
Year: 2001
Pages: 88

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net