An often-overlooked aspect of programming projects is the amount of time needed for debugging and optimizing the programs. A PHP programming project is no different. In fact the unique environment in which PHP scripts are developed and deployed present specific challenges as well as new avenues to debug and optimize programs. However, the core concepts of planning for debugging and optimization remain the same as with traditional programming tools.
In this chapter we will take an in-depth look at the various programming pitfalls, their avoidance, and the tools at our disposal to minimize and thwart erroneous code. In this chapter we'll look at:
An overview of the programming errors
Error levels in PHP:
Parse errors
Fatal errors
Warnings and notices
Core and compile errors
User error levels
Setting the error reporting levels
Defensive programming to minimize errors:
Debugging and testing tools:
HTTP debugging utilities like telnet clients and snoop servers
Debugging by tracing using phpCodesite
Remote debuggers such as BODY and Zend IDE
Script testing using phpUnit