Configuring Netbeans to debug your Drupal code

Rod Tatham's picture
Rod Tatham

Setting up your xdebug debugger to work on the IDE Netbeans can be somewhat fiddly. I hope these steps will help you out. They are for an Ubuntu desktop, but should be helpful whatever OS you're using.
(a) Install xdebug. For me, this just meant running:-
sudo apt-get install php5-xdebug
(b) Make sure that the file is set up in your php.ini file. To do this, first find the .so file:
Run the 'find' command to locate it:-
find / -name '' 2> /dev/null
(This returned '/usr/lib/php5/20060613/' for me)
Open your 'php.ini' file to edit it:-
sudo gedit /etc/php/apache2/php.ini
Add this at the bottom of your php.ini (you'll need to adapt to your path - '20060613' will probably need to change...):-
(c) Make sure that the config of xdebug is set up:-
Open your configuration file for xdebug:-
sudo gedit /etc/php5/conf.d/xdebug.ini
Add the following lines to the file:-
(d) Restart Apache:-
sudo /etc/init.d/apache2 restart
(e) Check your configuration of xdebug in Netbeans (Tools > Options > PHP > Debugging). Defaults should be fine.
That's it - you should be ready to run your debugger! Here's a good intro to get you started.
Further reading:-
Netbeans config - on
Debugging Drupal
Installing Drupal on Ubuntu (includes setting up debugging)