This article or section is in the process of an expansion or major restructuring. You are welcome to assist in its construction by editing it as well. If this article or section
Theses instructions should work fine on any Debian based distribution such as Debian, Ubuntu, LinuxMint, Xubuntu, Kbuntu and others.
Xdebug is an extension which provides debugging and profiling capabilities, it runs in the server side and send the debugging information to any client capable receive and read it, for this article we will install Xdebug in our local server and use Eclipse IDE as the client who will receive and interpret the debugging information. Whit Xdebug you will be able to study the behavior of your code step by step and also inspect the value of the all the variable on any execution step.
There are several ways to download and install Xdebug to your Linux box, you can do it from your software center, terminal or manual download.
NOTE: This method is the most you will updates and security patches automatically.
sudo apt-get install eclipse
sudo gedit /etc/php5/conf.d/xdebug.ini
xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_port=9000
sudo service apache2 restart
When a PHP project is being debugged the PHP code execution is stopped at any give break point the user sets, by default this action opens up the Eclipse IDE internal browser to display the web page itself, and resulting html output. if you wish to not use the Eclipse IDE internal browser for any reason, you can always use an external browser such as Google Chrome, Chromium or Firefox to browse your page in debugging time.
To set up a different web browser follow these steps if you are OK with the Eclipse internal browser skip this part:
To test our brand new debugger we need to create a little Eclipse PHP project, set the debug configuration for our project and write some few lines of PHP code. This example assumes that you understand the Eclipse IDE concepts of "workspace" and "projects", if you don't, pleas read this document Configuring Eclipse IDE for PHP development/Linux#Understanding the folder structure, also for this example we will use the site web root folder as our workspace, so Eclipse IDE and the web server files share the same location for our development purposes and easy testing.