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
- http://xdebug.org/wizard.php xdebug setup wizard
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:
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: http://www.jetbrains.com/phpstorm/marklets/
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.
- Very useful: detailed walk-through with screen shots
Setup with EclipseEdit
Setup with NetBeansEdit