How to install PEAR and PHPUnit in Debian/Ubuntu

In general terms, it’s very easy to install/upgrade new software in APT distros such as Debian/Ubuntu.

I don’t want to say doing so for PHPUnit or PEAR is more difficult, but has a little, tricky part, upgrading PEAR. If you don’t upgrade PEAR, PHPUnit will complain about an insufficient version and the installation will abort.


sudo apt-get install php-pear
sudo pear channel-update
sudo pear upgrade pear
sudo pear channel-discover
sudo pear channel-discover
sudo pear channel-discover

sudo pear install -a phpunit/PHPUnit

Additionally, if you want to include code coverage in your tests, you have to install the xdebug PHP extension.

sudo apt-get install php5-xdebug

Happy testing!


电子邮件地址不会被公开。 必填项已用 * 标注


您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>