WHAT'S IN THIS CHAPTER?
Using PHP back-traces
Learning what you need to review SQL performance
Understanding how to review SQL statements with
Learning about different index optimizations
No matter how well thought out or planned an application is, there are always problems and they can creep up at any moment. Ranging from performance issues to functionality flaws, you may feel it's completely impossible to find and diagnose them.
Fortunately PHP and MySQL have tools to help deal with such situations. This chapter covers the tools of the trade and best practices for debugging and optimizing PHP and MySQL. It starts with advanced PHP debugging — including ways to find hidden performance bottlenecks — and then gets into the details on how to make slow queries run fast.
For simple applications it is possible to get away with just basic debugging techniques. Some of the most common are using
print_r() to recursively display the contents of an array or class or
var_dump() when a little bit more information is needed.
For more complex applications, basic debugging is simply not enough. It becomes necessary to closely inspect the state of the application. This section reviews methods for inspecting state, injecting code into the application at run time, and profiling the application to achieve performance boosts.
One of the most basic forms of PHP debugging is the debug back-trace, which produces an associative array ...