如果没有安装pear先安装pear

http://pear.php.net/go-pear.phar

下载文件go-pear.phar到php安装目录下

命令行执行:php go-pear.phar

 

添加channel:

pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com

然后安装PHPUnit:

pear install phpunit/PHPUnit

 

如果安装失败

那么我们更新一下pear就可以了:

pear channel-update pear.php.net
pear upgrade-all

再安装:

pear install phpunit/PHPUnit

 

来安装PHPUnit,应该就可以看到Install ok了。

如果还是不行,执行下

pear clear-cache

再安装

 

Error:Unknown remote channel: pear.symfony.com phpunit/PHPUnit requires package"channel://pear.symfony.com/Yaml"(version >=2.1.0)No valid packages found

解决:pear channel-discover pear.symfony.com pear install pear.symfony.com/Yaml