Bill Shupp Software engineer, photographer, musician, space geek


More on step debugging in PHP

Having recently wrote about PHP step debugging in VIM, I thought I'd share a couple of things I've come across since writing it.

First, I find that I often need step debugging when writing unit tests, as that's when I'm really scrutinizing logic.  It turns out it's pretty easy to do.  All you need is to set the XDEBUG_CONFIG environment variable like so:

XDEBUG_CONFIG="idekey=session_name" php bin/phpunit.php tests/FooTest.php

When debugging from VIM, you'll want to have two shells open. One running the debugger, and another executing the tests. Also, note that in a shared environment, you can still pass in xdebug ini settings like so:

XDEBUG_CONFIG="idekey=session_name" \
php -d xdebug.remote_host= bin/phpunit.php tests/FooTest.php

Second, for step debugging in VIM, I've settled on this plugin (there are many versions out there).  It seems to solve problems with tab handling that I was seeing with older versions.




UPDATE: There's a new VIM plugin that's much better for step debugging.  Check out the announcement here:

Comments (3) Trackbacks (0)
  1. Howdy Bill!

    I’m just learning how to use xdebug with GVim and I remembered that you had written about the firefox plugin a while back. I’m writing my first WP plugin, so it’s time to take the next baby step and learn how to use some debugging tools. Your posts were helpful, thanks! I’m glad to see you are taking full “pride of ownership” at your place. What neighborhood are you in? (i grew up in the east bay)


  2. Hi Ian! Nice to see you working with GVim. Vim is my text editor of choice, and I really like it.

    The home ownership thing has been a lot of fun, though expensive at times. But we’re trying to take more upkeep tasks in house, as you can see. It’s been liberating to learn how to fix stuff ourselves! We’re in South San Francisco, btw, near the SFO airport.



  3. Very cool..
    There’s something really good about owning a tangible asset (like a house or piece of land) right now. I think you guys bought at a good time as well if I remember correctly.
    I’ll give you a holler next time I fly through SFO and buy you a beer!

    btw, Zack H. and I have been playing some silly gigs together with a mutual friend. (your name always comes up)

Leave a comment

No trackbacks yet.