Wednesday, April 17, 2013

Installing XDebug on Ubuntu 12.04

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


  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



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


  1. Or you can just use:

    sudo pecl install xdebug

    for the same effect.

    1. Case you need to install it on a single machine it does not make a difference. If you have to install it on several machines creating deb package is a way to go no doubt.

  2. zend_extension=/usr/lib/php5/20100525/

    i apply the same steps but i can not find the 20100525 folder for zend_extension ... can u help me ?

    1. Check output of phpize. It should look like:
      $ phpize
      Configuring for:
      PHP Api Version: 20100412
      Zend Module Api No: 20100525
      Zend Extension Api No: 220100525

      Zend Module Api No should correspond to folder name in which is located.

      You could also list content of folder /usr/lib/php5 and find desired folder name.
      ls /usr/lib/php5

      Finally you could use command locate.
      locate You might need to run sudo updateddb before running locate command.

  3. This comment has been removed by the author.