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:

[sh]
#!/bin/bash
XDEBUG_CONFIG=”idekey=YOURIDEKEYHERE” php -dxdebug.remote_host=`echo $SSH_CLIENT | cut -d “=” -f 2 | awk ‘{print $1}’` $1
[/sh]

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

BAM! I just unlocked the White Hat cap on @mojolive! http://t.co/GWVUht8R

@dshafik [2 weeks ago]

@rdohms @weierophinney especially here in Florida.

@dshafik [2 weeks ago]

@Arkantoze yeah, but NOT RIGHT OUTSIDE THE FRIGGEN DOOR

@dshafik [2 weeks ago]

@dshafik cool looking spider web!

@Arkantoze [2 weeks ago]

@dshafik Very pretty… and remember, spiders eat other insects…

@weierophinney [2 weeks ago]

Books & Things

Search

Archives

Tags