Chapter 31. Debugging PHP Programs
Debugging — finding and eliminating errors — is part of software development. As a PHP programmer, you should be aware of all the tools available to you as you seek to eliminate malfunctioning elements in your software systems.
There are many such tools, not least because PHP applications usually rely on the capabilities of several servers (such as an HTTP server and a database management server), each of which typically comes equipped with its own logging and reporting capabilities with which it keeps its users hip to what's happening. Plus, PHP has a considerable error-reporting facility of its own (you can choose to have error messages printed alongside normal output or logged to a file for more discreet analysis). The language also has a number of functions with which you can have your programs generate custom error reports, and at the very least you can use conditional print statements to monitor the activity of programs (and the values of variables within them) as they execute.
On top of the built-in error-reporting capabilities of PHP and its supporting technologies, PHP programmers now have access to the sorts of debugging tools that programmers working with other languages have had for years. Chief among these is the Zend debugging environment, which allows you to monitor variable values, set breakpoints, and step through programs at ...
Get PHP6 and MySQL® 6 Bible now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.