xdebug is a php module that allows debugging of php code directly in the IDE. With the help of the xdebug module, you can debug web requests with break points, variable inspection, etc.



Under Ubuntu, you can just install the xdebug package:

 apt-get install php5-xdebug

Mac OS XEdit

(assuming that you have homebrew installed):

 brew tap josegonzalez/homebrew-php # set up the centralized repository for PHP-related brews by josegonzalez
 brew install php53-xdebug




PHP ConfigurationEdit

Fox your IDE to be able to talk to xdebug, you need to enable remote debugging. Put this into your configuration:


This can be done in your php.ini or a related configuration file. On Ubuntu, the correct file would be:


Browser SetupEdit

In order to debug a web application with xdebug, you need to start a debug session somehow. The simplest way to do this is a bookmarklet in your browser.


To start an xdebug session for some site (typically localhost, but could be anything), create a bookmarklet with the following content:


You can also use the bookmarklet generator:

If you are using PHPStorm, you may also want to install the JetBrains Firefox extension to enable JavaScript debugging. Note however that this plugin actually listens on a TCP port - make sure it's not open to the outside...



IDE SetupEdit

Setup with PHPStormEdit

  • Set a Breakpoint
  • Start listening on the debug interface (click the red phone/handset button; it should turn green).
  • Use your browser to request a page
  • If necessary, configure path mappings for your project (PHPStorm will ask you when you hit a breakpoint for the first time).
  • You should now be able to step through the code line by line, inspect variables, etc.

Setup with EclipseEdit


Setup with NetBeansEdit