Join Jon Peck for an in-depth discussion in this video Deciphering backtraces, part of Debugging PHP: Advanced Techniques.
The PHP function, debug_backtrace generates a backtrace.…A backtrace is a report containing a sequence of nested function and method …calls to the point where the trace is generated, which gives context …to a developer to know what happened.…This is especially useful when working with frameworks and nested structures…with many file inclusions, functions calling functions, and so forth.…Debug backtrace returns associative arrays keyed by the frame, which is like…a depth in ascending order where the lowest number is the last thing to be executed.…
For each frame, you will be given the function name, line and file if any, …class and object if any, and arguments.…I'm going to demonstrate how to generate and read backtraces in order to get context.…Backtraces are excellent for development but not for reporting errors, …and I'll show you why that is in a moment.…First, go to the IDE and navigate to after the shutdown function.…I'm going to create a short sequence of functions that call one another, …
This course covers installation of Xdebug on Apache as well as working with the NetBeans IDE (integrated development environment). Jon then introduces native web browser developer tools for Firefox and Chrome, and demonstrates browser independent web debugging tools. Best practices for debugging and profiling web application failures and performance issues are also covered.
- Configuring PHP error reporting
- Logging errors to file
- Gracefully handling fatal errors
- Installing Xdebug
- Understanding the principles of remote debugging
- Remote debugging with NetBeans
- Extending your browser with Firebug, FirePHP, or ChromePHP