-
Notifications
You must be signed in to change notification settings - Fork 12
Debugger
David Laing edited this page May 6, 2013
·
5 revisions
You WordPress Development Flow dev VM includes to-debug - a browser based PHP debugger. This allows you to set breakpoints and step through your running PHP code line by line to debug tricky problems - a far more efficient way to diagnose errors than var_dump()
/ print_r()
.
To use the debugger:
- Start up your dev server as per normal, stopping just before the final
rake run
step - Run
rake debug
instead - Set a breakpoint in your plugin code by adding a
xdebug_break();
call at line you want the debugger to stop at. - Now open
http://localhost:4567
in Chrome
Debugging only works with Chrome
- Navigate to the page where you want to start the debugger.
- Click the
Launch debugger
link at the bottom of the page. - A new
ti-debug
tab will open; which attempt to open a popup window. If this is blocked by your browser's popup blocker; be sure toallow popups from localhost
and manually open the popup. - The popup contains the debugger, which you should recognise as very similar to Chrome's Javascript debugger. Hit
Play
to advance to yourxdebug_break();
breakpoint. - Debug away - inspect variables, advance line by line etc.
- When done, close the debug popup window.
- Refreshing your
http://localhost:4567
window will cause another debug window to pop open. To stop this behaviour, close theti-debug
tab