PHPUnit 3.5 and Pear 1.9.1 on Debian

I was a little frustrated today while trying to install PHPUnit 3.5 on my Debian box.

The new version of PHPUnit requires pear 1.9.1 so I did the usual upgrade. Running pear upgrade pear to make sure everything was up-to-date:

pear install PEAR-1.9.1
pear/PEAR is already installed and is the same as the released version 1.9.1
install failed

but when I did pear install phpunit/PHPUnit I got the following:

phpunit/PHPUnit requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/DbUnit requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
phpunit/PHP_CodeCoverage requires package "phpunit/File_Iterator" (version >= 1.2.2)
phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
No valid packages found
install failed

To confirm this I did pear -V and got:

PEAR Version: 1.9.0
PHP Version: 5.3.2-2
Zend Engine Version: 2.3.0

WTF?

Well after a little debugging I figured it out. The debian apt-get install php-pear creates a file in /usr/bin/pear. This file sets the include_path to /usr/share/php and loads the pearcmd.php file from there. In Pear 1.9.1 the pearcmd.php file is actually in PEAR/pearcmd.php. It moved. The appropriate pear bin file is in /usr/share/php/bin so to fix the issue:

sudo rm /usr/bin/pear;
sudo ln -s /usr/share/php/bin/pear /usr/bin/pear

now pear -V says:

PEAR Version: 1.9.1
PHP Version: 5.3.2-2
Zend Engine Version: 2.3.0

and I can now run pear install phpunit/PHPUnit successfully.