Large PHP developments, like Joomla!, Magento or PrestaShop can be very complex to debug without using a tool that provides variable inspections and breakpoints. This article describes how to configure your Ubuntu development machine with debug capabilities.

1Install Xdebug

Xdebug is a PHP extension for powerful debugging, using BDGp protocol, that can be linked to Aptana, so it catches all breakpoints from your local web server, in this case, Apache.

1.1. Install package

In Ubuntu 12.04, as simple as:

sudo apt-get install php5-xdebug

1.2. Configure

In case you need it in order to change port, i.e., configuration file is /etc/php5/apache2/conf.d/xdebug.ini. This are the standard contents:




1.3. Restart Apache

Graceful, please:

sudo apache2ctl graceful

2Aptana configuration

We'll asume Xdebug is working, and go straight to configure Aptana:

2.1. General preferences

First, check that Xdebug is properly configured in Window → Preferences → Aptana Studio → Editors → PHP → Debug. It should be in the installed debuggers, and with the same port that is in xdebug.ini.

Aptana PHP debug preferences window

Now you should make Aptana to use an external browser, in Window → Preferences → General → Web Browser.

2.2. Debug configurations

Next step is tell Aptana how will debug. Go to Run → Debug Configurations, select PHP Web Page, and press the 'New' button. Select XDebug as server debugger and create a new PHP server, with following data:

 Aptana debug configurations window

3Browser configuration

Last step is add an extension for your favourite browser, in order to enable or disable debug easily.

3.1. Mozilla Firefox

The easiest Xdebug:

The easiest Xdebug Firefox extension buttons

3.2. Google Chrome

Xdebug helper:

Google Chrome Xdebug helper extension buttons


That's it! You can now switch to debug perspective in aptana, add breakpoints in your code, inspect variable values, etc. Just enable debug in your browser, navigate to a page that uses your PHP script and wait for your breakpoint to jump.

Sources / More info


In case you found problems, like segmentation faults, try disabling coredump generation from Apache, with this commands:

ulimit -c 0
sudo /etc/apache2/restart

If you still have problems, try removing Xdebug from repositories and installing from PECL:

sudo apt-get remove php5-xdebug 
sudo apt-get install php5-dev 
sudo pecl install xdebug