Debugging on the Command Line with xdebug

Thanks to some help from Derick and my co-worker Trevor, I now have a simple bash script that will let me and my team easily debug CLI scripts on our development server.

The script is as follows:

#!/bin/bash
XDEBUG_CONFIG="idekey=YOURIDEKEYHERE" php -dxdebug.remote_host=`echo $SSH_CLIENT | cut -d "=" -f 2 | awk '{print $1}'` $1

This simple script will use your SSH_CLIENT environment variable to set the xdebug.remote_host setting correctly. Just set your idekey, and you’re good to go.

I put it in /usr/local/bin/xdebug and you call it simply with xdebug file.php with your debugger
running on the machine you’re SSH’ing from.

Works great!

- Davey

Comments are closed.

Twitter

@JillyEnFuego it's where they pretend a bunch of folks survived the apocalypse and what they have to do to survive; reality style

@dshafik [11 hours ago]

@dshafik Oooh! See that's why I have to DVR things, I can't keep up with when shows come on.

@tattooedmommie [13 hours ago]

@tattooedmommie it started last night...

@dshafik [13 hours ago]

@dshafik hahahaha.. doesn't everyone?

@beth_warren [14 hours ago]

@david973 I've known her 14 years; so I'm not far behind :P

@dshafik [14 hours ago]

Books & Things