Install xdebug on ubuntu

Debugging with scripting language is different with programming language. You need special tool to debugging in scripting language. In PHP we can use xdebug to increase verbosities of PHP.

I assume apache2 and php5 is installed and working well, and here's how we install xdebug in ubuntu thanks martin_lindhe and Jarrod Nettles

Jarrod Nettles version

Step 1

Install xdebug with apt-get

sudo apt-get install php5-xdebug

Step 2

In my ubuntu (Saucy Salamander 13.10) file xdebug.so placed in /usr/lib/php5/20110331/xdebug.so so you need to add this line to the end of this /etc/php5/apache2/php.ini

zend_extension="/usr/lib/php5/20110331/xdebug.so"

Make sure that html_error is on. Find this line in /etc/php5/apache2/php.ini

html_errors = On

Step 3

Restart apache with this command

sudo service apache2 restart

or

sudo /etc/init.d/apache2 restart

martin_lindhe version

martin_lindhe use pecl approach.

Step 1

Install php5-dev and php5-pear via apt-get

sudo apt-get install php5-dev php-pear

Step 2

then install xdebug via pecl

sudo pecl install xdebug

Step 3

Find xdebug.log location and add it into end of file /etc/php/apache2/php.ini file

asep@thinkblack:/$ find / -name 'xdebug.so' 2> /dev/null
/usr/lib/php5/20121212/xdebug.so

Step 4

Restart apache with this command

sudo service apache2 restart

or

sudo /etc/init.d/apache2 restart

Comments