Wednesday, February 2, 2011

Install xdebug for PHP5 in Ubuntu


This method will work for Ubuntu 8.04 and above
sudo apt-get install php5-xdebug

*********************************************************

This is the alternate method to install Xdebug :)

Here is a mini-howto in how to install the xdebug extension with PHP5 in Ubuntu

This will install xdebug 2.0 (or whatever is latest version in PEAR repository when you try this).

It is assumed you have Apache2 + PHP5 working already.

Code: sudo apt-get install php5-dev php-pear

Now install xdebug thru PECL.
Code: sudo pecl install xdebug

After installing above package it will show you the path of "xdebug.so" file, use it in your further steps.

Then edit php.ini:
Code: sudo gedit /etc/php5/apache2/php.ini

Add the following line:
Code: zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"

Then restart apache for changes to take effect
Code: sudo /etc/init.d/apache2 restart

Sometimes you also need to edit your "xdebug.ini"
sudo gedit /etc/php5/conf.d/xdebug.ini
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_port=9000
(Thanks to Chetan Jain for this settings)

**********************************************************

Check phpinfo() to make sure the extension is loaded correctly. The following line should have been appended to the copyright lines:

with Xdebug v2.0.0, Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, by Derick Rethans

For more information about xdebug configuration and usage, please read the official documentation, found here: http://xdebug.org/docs/

0 comments:

Post a Comment