我在redhat上使用php 5.2.10。默认安装的pear包是PEAR 1.8.0。现在我想通过pear安装PHPunit。因此,每当我运行命令安装phpunit时,它都会出错:
pear install --alldeps phpunit/PHPUnit
phpunit/PHPUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.8.0
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/DbUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.8.0
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed version is 1.8.0
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.1), installed version is 1.8.0
phpunit/PHP_CodeCoverage requires package "phpunit/File_Iterator" (version >= 1.2.2)
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2.0.5)
phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.2), installed version is 1.8.0
phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.2), installed version is 1.8.0
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed version is 1.8.0
No valid packages found
install failed
我已尝试升级pear的命令:
pear upgrade pear
pear upgrade --force pear
但它返回:
Nothing to upgrade
任何解决方案?
答案 0 :(得分:2)
尝试此命令:
pear upgrade --force http://pear.php.net/get/PEAR-1.9.4.tar
它将下载梨1.9.4的焦油并升级版本 如果它不起作用,请检查您的php是否支持.zlib。 如果不支持,则通过以下命令配置php with.zlib:
./configure --with zlib
在浏览器上通过phpinfo命令检查,它将在你的php信息页面支持zlib 运行以上命令升级您的pear版本并通过以下方式检查:
pear version
它会将您的梨版显示为1.9.4
然后运行命令:
pear install --alldeps phpunit/PHPUnit
答案 1 :(得分:1)
如果你使用RHEL 6,你有php-pear> = 1.9.4 你只需要通过yum更新,比如yum install php-pear
但是如果你这样做,它也可能会更新你的php安装。您将拥有要更新的所有包的列表,您可以选择接受或取消。
答案 2 :(得分:1)
如果pear告诉你“无需升级”,你应该清除缓存:
$ pear clear-cache
$ pear upgrade pear