How to install Xdebug on Debian based OS like Ubuntu

sudo apt-get install php5-dev

sudo pecl install xdebug

Edit the php.ini file, located on /etc/php5/apache2/php.ini

Add following lines to the php.ini file:

[Xdebug]
zend_extension = "/usr/lib/php5/CHECK_OUT_DIRECTORY_NAME/xdebug.so"
; Use Get or Post parameter XDEBUG_PROFILE=1 to create a new cachegrind file.
xdebug.profiler_enable_trigger = 1
xdebug.profiler_enable = 0
xdebug.remote_enable = 1
xdebug.profiler_output_dir = "/tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"

 

sudo service apache2 restart