Wednesday, April 17, 2013

Installing XDebug on Ubuntu 12.04

mkdir ~/opt && cd ~/opt
wget http://xdebug.org/files/xdebug-2.2.2.tgz
tar -xzvf xdebug-2.2.2.tgz && cd xdebug-2.2.2/
phpize
auto-apt run ./configure
make
sudo checkinstall
sudo nano /etc/php5/mods-available/xdebug.ini
sudo php5enmod xdebug
php -i | grep xdebug

Explanation

  1. Create directory opt inside the home directory and change to created directory. Change directory name and location as needed
  2. Get the latest version of Xdebug. Adjust URL to point to the latest or desired Xdebug version
  3. Prepare the build environment for a PHP extension. See phpize manual.
  4. Use auto-apt just in case there are missing dependencies. Not likely to happen in this case.
  5. Build extension
  6. Create and install deb package. For details see Checkinstall wiki.
    1. The package documentation directory ./doc-pak does not exist.
      1. Should I create a default set of package docs?  [y]: 
      2. Type y
    2. Please write a description for the package.
      1. End your description with an empty line or EOF.
      2. Enter Xdebug 2.2.2 or whatever might be suitable
    3. This package will be built according to these values:
      1. Options 0 to 13 listed
      2. Enter a number to change any of them or press ENTER to continue:
      3. Make changes as needed
  7. Create extension configuration file. For details see Xdebug Documentation.
  8. Enable extension
  9. Check if extension is installed and configured

Basic extension configuration

zend_extension=/usr/lib/php5/20100525/xdebug.so

Prerequests

See Compiling Software wiki entry. Aside from basics php5-dev package must be installed on the system.