[英]How to fix error when installing pear in order to install phpunit?
I am not quite sure if the question belongs to this forum, so if not and you are about to close this question, please make a suggestion where else to ask this question. 我不太确定该问题是否属于该论坛,因此如果不是,并且您即将结束该问题,请提出建议,在哪里还可以提出该问题。
Basically, I need to install phpunit
on Ubuntu 12.04. 基本上,我需要在Ubuntu 12.04上安装phpunit
。 By doing so with the packet manager I get an error when running phpunit
: 通过使用数据包管理器执行此操作,在运行phpunit
时出现错误:
PHP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/bin/phpunit on line 38
for which there are solutions , ie to install phpunit
with pear
. 为此,有解决方案 ,即用pear
安装phpunit
。
Following the pear install instructions I download and run go-pear.phar
, which itself produces an error 按照pear安装说明,我下载并运行go-pear.phar
,它本身会产生错误
PHP Notice: Uninitialized string offset: 0 in phar:///home/alexander/opt/src/go-pear.phar/Console/Getopt.php on line 145
Any suggestions how to proceed from here? 有什么建议如何从这里继续吗? I also ONLY need phpunit
, so pear
will be used just for this case once. 我也只需要phpunit
,所以pear
只会在这种情况下使用一次。
The installation of phpunit
really seems to be extremly complicated and circumstantial, but here is the solution: phpunit
的安装确实确实非常复杂和麻烦,但这是解决方案:
pear
should be already installed 至于Ubuntu 12.04 pear
应该已经安装 pear
should be used 但是,应该使用最新版本的pear
phpunit
need to be removed before it is reinstalled 并且需要重新安装phpunit
The whole procedure and each step is described on symfony-world , one might need the additional step shown in the given comment. 整个过程和每个步骤都在symfony-world上进行了描述,可能需要给定注释中所示的其他步骤。 Here is a copy-and-paste of the complete procedure for Ubuntu 12.04: 这是Ubuntu 12.04完整过程的复制和粘贴:
sudo apt-get remove phpunit
sudo apt-get upgrade pear
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony.com
sudo pear update-channels
sudo pear upgrade-all
sudo pear install --alldeps phpunit/PHPUnit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.