Getting Xdebug for PHP working with Sublime Text 2 is slightly tricky.

Most of the instructions are at - these notes are just a bit extra as a reminder to myself.

After installing Xdebug with "sudo apt-get install php5-xdebug", you have to add some xdebug  settings in /etc/php5/conf.d/xdebug.ini:

zend_extension = /usr/lib/php5/20090626+lfs/

In ST2, you use SHIFT+F8 to get the Xdebug menu, and select "Start debugging". In your browser session, add a url parameter like this:


The page request should hang while the debugger has control - if nothing's happening in ST2, you'll need to check the console window by using "CTRL`".

You may get this output:

Traceback (most recent call last):
File "./", line 362, in run_
File "./", line 553, in run
File "./", line 97, in read
File ".\xml\dom\", line 1927, in parseString
File ".\xml\dom\", line 32, in <module>
File ".\xml\parsers\", line 4, in <module>
ImportError: No module named pyexpat

In which case you've got the problem with Python versions - 2.7 is the default on Ubuntu 12.04, and ST2 and the Xdebug plugin are using Python 2.6.

So follow the instructions at the bottom of the README at

On Ubuntu 12.04, Python 2.6 isn't available, so here's what worked for me:

    * Download python2.6 files from <a href="">Ubuntu Archives</a>
    * Extract the files: dpkg-deb -x python2.6_2.6.5-1ubuntu6_i386.deb python2.6
    * Copy the extracted usr/lib/python2.6 folder to {Sublime Text directory}/lib

(I actually copied the usr/lib/python2.6 directory to /usr/lib/python2.6, and symlinked to there from {Sublime Text directory}/lib)

Then restart ST2 and try again. Once you hit a breakpoint, it should look like this, with the Xdebug Context and Xdebug Stack windows showing content: