In this tutorial we are going to set xdebug for php on Ubuntu server and we are going to use Google Chrome as a browser in our debugging process.
Let’s setup server. Log in to your ubuntu box.
1. Install xdebug for php
sudo aptitude install php5-xdebug sudo /etc/init.d/apache2 restart
2. Check installation
php -v arturito@hokage:~$ php -v PHP 5.3.3-1ubuntu9.3 with Suhosin-Patch (cli) (built: Jan 12 2011 16:08:14)Copyright (c) 1997-2009 The PHP GroupZend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
3. Edit php.ini
sudo nano /etc/php5/apache2/php.ini
4. Stick these lines in:
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so" xdebug.remote_enable=on xdebug.remote_host=localhost
5. Install Google Chrome xdebug extension:
https://chrome.google.com/webstore/detail/eadndfjplgieldjbigjakmdgkmoaaaoc
6. In Chrome go to Tools>Extensions

7. Click on Options and add domains you want to be able to debug

8. Open NetBeans and go to Tools > Options > PHP

9. Now create new project as a test and set the breakpoint.

10. Hit Ctrl + F5
Your browser will hang.
![]()
and you will be able to step through the code

Additional:
If your webserver is not installed on your machine but it is on the separate one you should set xdebug.remote_host to the IP of your development machine.
For example I run ubuntu with apache in virtual box so I set
xdebug.remote_host=192.168.1.5
where 192.168.1.5 is the IP of my Windows host OS where I have NetBeans installed.
