Setting up XDebug to Debug PHP Applications

Published May 19th, 2012


The following are general instructions as to how to set up XDebug and should work for most any environment you may be using whether it is Apache or IIS. You will want to make sure before continuing that you have a web server installed and running on which to do your PHP debugging using XDebug.

First you will need to download the latest version of XDebug from http://xdebug.org/download.php for the type of system your web server is running on.

Next place the XDebug binary you just downloaded into your PHP extensions directory depending on where you installed PHP for example C:\PHP\ext\.

Now you will need to open your php.ini file in your favorite text editor and add the following lines to the end of the file. These setting will later on help you in setting up tools such as Eclipse to work properly with XDebug on this server.

[xdebug]
 xdebug.remote_enable=1
 xdebug.remote_host=”localhost”
xdebug.remote_port=9000
 xdebug.remote_handler=”dbgp”
zend_extension = C:\PHP\ext\php_xdebug-<replace with correct version>.dll

Restart your web server or PHP process to allow for these changes to take place and check your phpinfo() output to make sure XDebug set up properly.