我试图在运行CentOS 5.8的Linux机器上安装PHPUnit,并且遇到了一堆问题。
我正在运行PHP版本5.4.12(Remi安装)。
首先要注意的是,我在/usr/share/pear和/usr/share/php中都有两个pear安装。
首先我尝试了
pear install --alldeps php/PHPUnit
这给了我:
phpunit/PHPUnit requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9 phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed version is 1.4.9 phpunit/Text_Template requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9 phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9 phpunit/PHP_CodeCoverage requires package "phpunit/File_Iterator" (version >= 1.3.0) phpunit/PHP_CodeCoverage requires package "phpunit/Text_Template" (version >= 1.1.1) phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2.0.5) phpunit/PHP_Timer requires PEAR Installer (version >= 1.9.2), installed version is 1.4.9 phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9 phpunit/PHPUnit_MockObject requires package "phpunit/Text_Template" (version >= 1.1.1) phpunit/PHPUnit_MockObject can optionally use PHP extension "soap" phpunit/PHP_Invoker requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9 phpunit/PHP_Invoker requires package "phpunit/PHP_Timer" (version >= 1.0.1) phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9 No valid packages found install failed
我的下一步行动是升级梨:
Skipping package "pear/PEAR", already installed as version 1.9.4 downloading Structures_Graph-1.0.4.tgz ... Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes) .........done: 30,318 bytes Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Validate.php on line 486 ERROR: unable to unpack /tmp/tmp4Gb17e/Structures_Graph-1.0.4.tgz
我注意到的是它说我有最新版本(1.9.4)。 pear version告诉我,否则(1.4.9)。 我不知道什么是tar文件错误的问题。
接下来我运行yum remove php-pear这样我就可以尝试重新安装最新的:
Running Transaction Erasing : php-pear 1/1 Removed: php-pear.noarch 1:1.4.9-8.el5 Complete!
我已经使用sudo yum install php-pear重新安装了梨sudo yum install php-pear ,并按照这里列出的说明,但现在我得到同样的错误,因为我试图安装PHPUnit(PEAR版本错误)。 为什么当我手动安装梨是不是给我最新的包?
现在我迷了路,似乎我有两个PEAR装置在浮动,我不知道如何处理它们,并从一个干净的石板开始。 谁会有任何想法如何纠正这种情况? 是我应该重新编译PHP,重新开始?
谢谢你的帮助。
好吧,我最终通过手动下载和安装PEAR来完成这个工作:
wget http://pear.php.net/go-pear.phar # Download the file php go-pear.phar # Execute the file via PHP
我没有意识到的是,PEAR本身可能已经过时了(这要感谢这篇文章 )
这就允许我安装PHPUnit。