I'm running debian 5.0.6 and have installed xdebug 2.0.3 via aptitude. Now I want to install PHPUnit, and when trying to do it through pear, I get the error that PHPUnit wants a more recent xdebug

phpunit/PHPUnit requires PHP extension "xdebug" (version >= 2.0.5), installed version is 2.0.3

Looking at the debian site, I don't see a package for 2.0.5. Is it safe to try upgrade xdebug outside of the apt system? I'm not entirely clear on how these things ( php, apache2, and xdebug ) are interrelated, and I don't want to break things and have downtime. My rough guess would be that I would build xdebug 2.0.5 and then restart Apache. If I go it alone, is aptitude going to trip up on that later, when an xdebug package comes out?


There is a recent enough version of xdebug in squeeze (the next release of Debian, which will be ready any month now). It doesn't have an official backport to stable (otherwise the backport would be listed on the xdebug package search page). The binary package depends on a recent version of PHP, but you should be able to compile the source package on lenny, since its build dependencies are satisfiable on lenny. Here's a recipe for building the package:

  1. Download the three files (.dsc, .orig.tar.gz, and .debian.tar.gz). Since this is a punctual need, just do it manually.
  2. Install the build dependencies (here debhelper and php5-dev) with apt-get or aptitude. Also install the basic set of development packages; the build-essential package will pull them all. Also install fakeroot.
  3. Unpack the source: dpkg-source -x xdebug_2.1.0-1.dsc and change to the source directory: cd xdebug-2.1.0.
  4. (You can skip this step if you don't make any change in the source package.)
    Edit the debian/changelog file to add a new changelog entry. This is easily done in Emacs:
    • make sure the dpkg-dev-el package is installed;
    • open debian/changelog in Emacs;
    • use C-c C-a to add an entry;
    • choose a new version number (here 2.1.0~user394+1 would be a reasonable choice, following the pattern used by the official backports);
    • write a log entry (e.g., backport to lenny, describe the changes you made);
    • use C-c C-c to finalize the entry.
  5. Compile the package: dpkg-buildpackage -rfakeroot -us -uc
    If you have a PGP/GPG key, don't pass -us -uc and enter your passphrase if prompted to cryptographically sign the packages.
  6. Profit Install the binary package.

To summarize the steps:

wget http://ftp.de.debian.org/debian/pool/main/x/xdebug/xdebug_2.1.0{.orig.tar.gz,-1.{dsc,debian.tar.gz}}
sudo aptitude install build-essential fakeroot debhelper php5-dev
dpkg-source -x xdebug_2.1.0-1.dsc
cd xdebug-2.1.0
# patch as necessary
emacs debian/changelog # not necessary if unpatched
dpkg-buildpackage -rfakeroot -us -uc
dpkg -i ../php5-xdebug_2.1.0_*.deb
  • This works, awesome, but why doesn't apt-get install allow you to install a specific version?
    – AlxVallejo
    Dec 22 '15 at 19:47
  • @AlxVallejo It does, but only if that version is available in the repository. Here the desired version of the software was not available for the desired release of Debian. Dec 22 '15 at 20:00

You are right, you can just install the php-dev package (to be able to compile against the existing PHP) and build an updated xdebug version, overwriting the debian version. The problem would obviously be that as soon as debian bumps their package (maybe just for a small patch) your changes would get overwritten. You could build your own package but that tends to be somewhat of a pain in the ass.

But from a downtime/problem point of view you should be OK (the worst that could happen would be that you'd maybe have to adjust the path of the xdebug extension in the php.ini file).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.