PHPUnit、PEAR 升级错误
注意:我已阅读有关此问题的所有问题
PEAR 已在我的系统(Ubuntu 11.10 + Apache/2.2.20)上安装和配置。因为
<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>
返回此:(
bool(true)
当我尝试使用 phpunit 时,出现此错误。
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
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
出现此错误后,我决定安装它,
sudo /usr/bin/pear install phpunit/PHP_CodeCoverage
但我
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.4), installed version is 1.9.2
在使用 sudo pear Upgrade
升级 PEAR 时遇到此错误,
PHP Fatal error: Call to undefined method PEAR_Registry::packageinfo() in /usr/share/php/PEAR/Dependency2.php on line 687
我不确定问题是什么?
附加
(命令
: 结果
)
/usr/bin/pear config-get php_dir
: /usr /share/php
配置文件(php.ini)路径(在 phpinfo();)
: /etc/php5/apache2
php -c /etc/php5/apache2/php.ini -r 'echo get_include_path()."\n";'
: .:/usr/share/php
pear 升级 pear
: PHP 致命错误:在 /usr/share/php/PEAR/Dependency2.php 第 687 行调用未定义的方法 PEAR_Registry::packageinfo()
PEAR 版本:已安装 1.9.2 和 php-pear 软件包。
Note : I've read all questions about this problem
PEAR is installed and configured on my system (Ubuntu 11.10 + Apache/2.2.20). Because
<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>
Returning this :
bool(true)
(PEAR Manual : Checking if PEAR works Step 4)
When i tried to use phpunit i'm getting this error.
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 38
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
After this error i've decided to install it
sudo /usr/bin/pear install phpunit/PHP_CodeCoverage
But i'm getting
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.4), installed version is 1.9.2
I'm getting this error when upgrading PEAR with sudo pear upgrade
PHP Fatal error: Call to undefined method PEAR_Registry::packageinfo() in /usr/share/php/PEAR/Dependency2.php on line 687
I'm not sure what is the problem ?
ADDITIONAL
(command
: result
)
/usr/bin/pear config-get php_dir
: /usr/share/php
Configuration File (php.ini) Path (on phpinfo();)
: /etc/php5/apache2
php -c /etc/php5/apache2/php.ini -r 'echo get_include_path()."\n";'
: .:/usr/share/php
pear upgrade pear
: PHP Fatal error: Call to undefined method PEAR_Registry::packageinfo() in /usr/share/php/PEAR/Dependency2.php on line 687
PEAR Version : 1.9.2 and php-pear
package installed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
PEAR 1.9.2 已经过时并且损坏,无法用较新的 Pear 服务器基础设施进行修复。
我不知道为什么发行版仍然坚持使用刚刚损坏的东西:)
通过 go-pear.phar 安装新的 pear
并确保您拥有pear 版本 1.9.4
,然后强制 pear 忽略它的旧版本 缓存文件使用“摆脱” 老梨:
现在
应该会导致找不到命令。如果它仍然存在,请删除 /usr/share/php 中的二进制文件和关联的 php 类。
从您的控制台历史记录来看,我想说您没有使用
sudo
权限安装新的 pear,因此它落在 /home/ 或 /usr/local/ 中,而不是在默认系统位置。就没关系,
PEAR 1.9.2 is outdated and broken beyond any hope of repair with newer pear server infrastructure.
I have no clue why distributions still insist on something that is just broken :)
Install a new pear via go-pear.phar
and make sure you havepear version 1.9.4
and then force pear to ignore it's old cache files usingGetting rid of the old pear:
Now
should result in the command not being found. If it is still there delete the binary and the associated php classes in /usr/share/php.
From your console history I'd say you didn't install the new pear with
sudo
rights so it landed in /home/ or in /usr/local/ instead of in the default system location.It shouldn't matter as long as you
针对特定环境进行故障排除可能很困难...但是,这里...
在不使用实际的
pear.phpunit.de
通道安装 PHPUnit 时遇到了问题,尤其是在尝试使用 apt-get 或 yum 等包管理器时。首先,您需要确保您的 pear 安装是最新的。从包管理器中终止现有安装:然后确保删除可执行二进制文件(如果它仍然存在)。这可能是 /usr/bin/pear,但您可能需要根据您的环境修改路径:
接下来通过下载 go-pear.phar 和安装新的 pear执行它。 确保使用 sudo 权限(或以 root 身份)安装它,以便将其安装在正确的位置:
然后,您可以通过执行下一个命令来验证 pear 是否正常工作。如果是这样,您将获得命令列表:
最后,升级 pear (以防万一 - 毕竟您刚刚使用 go-pear.phar 获得了最新版本)。此后,确保您使用实际的 pear.phpunit.de 通道来安装 PHPUnit:
这对我来说效果很好...希望有帮助。
更新
要使 PHPUnit 的所有功能正常工作,您可能还需要执行以下操作:
您会认为 --alldeps 将涵盖这一点,但是...
更新 2
鉴于使用 go-pear.phar 安装方法持续出现问题,这是另一种方法 ...
接下来,告诉 PEAR 更新自己的频道。
然后,告诉 PEAR 将自身升级到最新版本。
最后,按照上面的规定安装 PHPUnit ...
It can be difficult to troubleshoot for a specific environment ... but, here goes ...
I've had issues when not using the actual
pear.phpunit.de
channel to install PHPUnit, especially when trying to use a package manager like apt-get or yum. First, you need to be sure your pear installation is up to date. Kill the existing install from your package manager:Then make sure you delete the executable binary file if it still exists. This is probably /usr/bin/pear, but you may need to modify the path based on your environment:
Next install the new pear by downloading go-pear.phar and executing it. Make sure you install it with sudo rights (or as root) so that it is installed in the correct location:
You can then verify that pear works by executing the next command. If so, you'll get a list of commands:
Finally, upgrade pear (just in case -- you did just get the latest version using go-pear.phar, after all). After this, make sure you use the actual pear.phpunit.de channel to install PHPUnit:
This has worked well for me ... hope it helps.
UPDATE
To get all the features of PHPUnit working you'll likely need to also do the following:
You'd think --alldeps would cover this but ...
UPDATE 2
Here's an alternative method given your continued issues using the go-pear.phar install method ...
Next, tell PEAR to update its own channel.
Then, tell PEAR to upgrade itself to the newest version.
Finally, install PHPUnit as proscribed above ...
我通过手动安装让我的工作正常运行。
I got mine working by doing a manual installation.
我刚刚升级了我的 Ubuntu 系统,并且 PEAR 1.9.4 稳定了。运行
以使您的 Ubuntu 同步并更新到最新状态。
如果您仍然对上述版本感到困扰,我的建议是安装与您的 phpunit 兼容的旧版本 PHP_CodeCoverage。在升级系统之前,我安装了 phpunit-3.5.15(稳定)、PHP_CodeCoverage 1.0.5(稳定)和 PEAR 1.9.2。如果这是您的 phpunit 版本,
则应使用 PEAR 1.9.2 安装 PHP_CodeCoverage。
我希望这对您有所帮助,并且您可以运行单元测试。
I've just upgraded my Ubuntu system and I've got PEAR 1.9.4 stable. Run
to get your Ubuntu synchronised and up to date.
If you were still struggling with the versions as above my suggestion is to install a previous version of PHP_CodeCoverage that is compatible with your phpunit. Before I upgraded my system, I had phpunit-3.5.15 (stable), PHP_CodeCoverage 1.0.5 (stable) installed with PEAR 1.9.2. If this is your phpunit version
should install PHP_CodeCoverage with PEAR 1.9.2.
I hope this helps and you get your unit tests running.