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

@dshafik that's why i returned mine (@eyeficard )

@vidluther [11 minutes ago]

Unhappy with my @EyeFiCard performance this weekend; no geo-tagging, wouldn't connect to my ad-hoc wifi, or upload to flickr. Complete #fail

@dshafik [3 hours ago]

Just had a wonderful massage to top off this most excellent 3 day weekend. Drinking water and relaxing while Fran has her turn.

@dshafik [8 hours ago]

@fraserspeirs Would love to see tagging with the camera/body as well as lens, and allow multiple upload sessions in Aperture Flickr Export

@dshafik [14 hours ago]

Books & Things