How to setup xdebug with Netbeans on Unbuntu

xdebug is a PHP extension for debugging of php code. It supports stack and function traces, profiling information and memory allocation and script execution analysis. It uses the DBGp debugging protocol.  In this post we are going to see easy steps to install and setup it with Netbeans IDE on Ubuntu

Step 1:

Install xdebug using following command

sudo apt-get install php5-xdebug

 

Step 2:

Browse to your php folder and locate xdebug.so file. In my case it is /usr/lib/php5/20121212/xdebug.so. Copy this files path.

Step 3:

Open your php.ini ( /etc/php5/apache2/php.ini ) and add following lines at the end of this file

[xdebug]zend_extension="/usr/lib/php5/20121212/xdebug.so"xdebug.remote_enable=1xdebug.remote_autostart=1xdebug.profilerenable=1xdebug.remote_handler=dbgpxdebug.idkey="netbeans-xdebug"xdebug.remote_mode=reqxdebug.remote_host=127.0.0.1xdebug.remote_port=9000

Replace zend_extension path with the path you have copied in previous step

Step 4:

Restart your apache server using

sudo service apache2 restart

Step 5:

Open Neatbeans and goto Tools > Options > PHP > Debugging and make sure that there is Debug Port set to 9000
and Session ID to “netbeans-xdebug

Step 6:

Thats it you are almost done. Now just create a new php project, add some breakpoints to any php file in it and click on Debug Project from tool bar or press ctrl+F5. This will start debugger.

 

Debugging Magento Project using xdebug with Netbeans on Ubuntu

Comments

Popular posts from this blog

MATLAB code for Circular Convolution using Matrix method

Positive number pipe in angular 2+