How do I correctly install PHPUnit with PEAR?

Use this, as described in the PHPUnit docs: (i don't what sudo means, this is how I do it on a windows PC):

pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit

I also had this error message:

Unknown remote channel: pear.symfony.com

Solved creating an alias:

pear channel-alias pear.symfony-project.com pear.symfony.com

and then

channel-discover pear.symfony-project.com

sudo pear channel-discover components.ez.no

sudo pear update-channels

sudo pear upgrade-all

sudo pear install --force --alldeps phpunit/PHPUnit

First: locate pear you may have multiple versions installed and this could be a pain.

At work we have something like this in our intranet:

sudo [your pear install] channel-update pear.php.net  
sudo [your pear install] upgrade pear  
sudo [your pear install] channel-discover pear.phpunit.de  
sudo [your pear install] install --alldeps phpunit/PHPUnit

I know theres a more automated way to install it using: go-pear ( http://pear.php.net/manual/en/installation.getting.php )

However, if you already have some other install of pear it will totally wreck everything and you'll spend quite some time trying to fix it. I think the biggest hurdle is being able to tell all the libraries where each other is.


I had the same problem while upgrading my phpunit.

This solved the problem:

pear channel-discover pear.symfony.com
pear install pear.symfony.com/Yaml

Then run:

pear install --alldeps pear.phpunit.de/PHPUnit

OBS: I think the pear install pear.symfony.com/Yaml is not necessary. I'm just posting it because it is exactly the way I solved my problem.