Tuesday, September 1, 2009

PEAR Installation Problem: unsupported protocal

I was trying to install PHPUnit, a member of XUnit family of testing frameworks. While running this command:

pear install phpunit/PHPUnit

I got this error:

pear.phpunit.de is using a unsupported protocal – This should never happen. install failed

What I found through investigation is that PEAR installations on PHP 5.2.9 and 5.2.10 seem to be corrupted and I am using PHP 5.2.9. This problem comes from corrupted channel files. The solution is: Go into your PEAR php directory and backup .channels directory.

cd `pear config-get php_dir`
mv .channels .channels-broken
pear update-channels

This means you lost all your channels except for the default ones (pear, pecl, doc and __uri) – but at least you do not have to re-install PEAR :)