I’m working on some code on the command line that I needed to debug. It’s on a remote machine (well, a VM that doesn’t have a GUI) and so I needed to initiate a remote debugging session from the command line to go to my local copy of Zend Studio. Thankfully, it’s pretty easy. Since I need a place to store this command so I can copy and paste it onto the CLI I figured I’d simply blog about it. Simply execute this command prior to executing your PHP script.
export QUERY_STRING="start_debug=1&debug_stop=1&debug_fastfile=1& debug_coverage=1&use_remote=1&send_sess_end=1&debug_session_id=2000& debug_start_session=1&debug_port=10137&debug_host=192.168.0.254" |
The only thing you will need to change is the debug_host setting and perhaps debug_port. Run your CLI script and the debugger will attempt to connect to your local Zend Studio instance. If you want to discontinue debugging you execute this command.
unset QUERY_STRING |

[...] to set up a remote debugging connection to your IDE. In his blog post, Kevin Schroeder explains how to do this. You can do this by running the following command, as copied from Kevin’s [...]