Wikibase/Notes/XDebug

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.

Ubuntu
Under Ubuntu, you can just install the xdebug package:

apt-get install php5-xdebug

Mac OS X
(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

Resources

 * http://xdebug.org/wizard.php xdebug setup wizard

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

xdebug.remote_enable=1

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

/etc/php5/apache2/conf.d/xdebug.ini

Browser Setup
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.

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

javascript:(/**%20@version%200.5.1%20*/function%20{document.cookie='XDEBUG_SESSION='+'PHPSTORM'+';path=/;';})

You can also use the bookmarklet generator: http://www.jetbrains.com/phpstorm/marklets/

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...

Chrome
TBD

Setup with PHPStorm

 * 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.


 * Very useful: detailed walk-through with screen shots

Setup with Eclipse

 * http://bogdan-albei.blogspot.de/2010/06/php-remote-debugging-with-xdebug-and.html

TBD

Setup with NetBeans
TBD