How to Configure PHP Project in Eclipse for Debug Mode

Eclipse is very important tool for any developer, all due to the vast library of open source and freely available plug-ins which provides almost every required facility for development environment.

Now if we are using Eclipse, then ‘debug’ mode in Eclipse is a very useful tool to debug the code. Putting prints in the code and tracking the print-outs on the server console is very tedious job. So here we are explaining; how we can configure Eclipse and PHP web server to enable debugging of PHP applications in Eclipse using XDebug (http://www.xdebug.org/docs/).

As PHP code runs on web server, so that means, debugging can be performed only on server. So we put the debugging information in PHP code file using eclipse in IDE, however we need to install XDebug on web server for actual debugging. XDebug will sit on the server, and will generate the required debugging information like variable dump, stack traces etc and put all of this information for public use on a specific port of the server. Now any application can access this debug information by sending request to server on this port.

Eclipse works on same concept for showing debugging information for PHP application. It connects to the web server on given port, and fetches the debug information to show in a user friendly way with its UI. So to configure the debug mode in Eclipse, we need to configure XDebug on web server and also need to configure the eclipse for XDebug properties. Configuration steps are as following: