Martijn's PHP Coding Blog


November 13th, 2009

Installing Eclipse for PHP development with XDebug for remote debugging - 3

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Time to debug by henribergius @ flickr

Time to debug by henribergius @ flickr

This post contains my installation notes on how to setup the Eclipse PHP IDE with support for XDebug remote debugging in a mixed Windows/Ubuntu development environment.

Debugging PHP with XDebug in Eclipse

Debugging PHP with XDebug in Eclipse

One of the great things of writing PHP code in a modern IDE is that you can step through your code, set break points and inspect variables. No more endless print/echo statements, or including your own custom logging code every few lines.

The war to decide the best IDE is far from over. If you would like to write PHP code and are looking for a free IDE (Integrated Development Environment) then both Eclipse PHP and the Netbeans IDE are two very strong candidates. Both are written in JAVA. For this post I concentrate on my own favorite: Eclipse. If you would like to compare several other PHP IDE’s then Davey Shafik has a great table comparing IDE features on his site.

Debugging is done through a remote debugger called XDebug. It ties into the PHP runtime on your server allowing Eclipse to communicate with your scripts / web pages. As soon as you start debugging a web page, Eclipse will call your webserver but also pass a couple of parameters. On seeing these parameters (XDEBUG_SESSION_START/KEY), XDebug will start and connect to Eclipse over a TCP/IP connection. From here on Eclipse can control the execution of the script on the webserver.

My development setup Read the rest of this entry »