Author: Gareth Downes-Powell
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.