PHPUnit , PEAR 升级错误

2022-01-25 00:00:00 ubuntu php phpunit pear

注意:我已阅读有关此问题的所有问题

PEAR 已在我的系统(Ubuntu 11.10 + Apache/2.2.20)上安装和配置.因为

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));
?> 

返回这个:

bool(true)

(PEAR 手册:检查 PEAR 是否工作步骤 4)

当我尝试使用 phpunit 时出现此错误.

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

但我明白了

phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.4), installed version is 1.9.2

使用 sudo pear upgrade

PHP Fatal error:  Call to undefined method PEAR_Registry::packageinfo() in /usr/share/php/PEAR/Dependency2.php on line 687

我不确定是什么问题?

附加

(command : result)

/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()." ";' : .:/usr/share/php

php -c /etc/php5/apache2/php.ini -r 'echo get_include_path()." ";' : .:/usr/share/php

pear upgrade pear : PHP 致命错误:在第 687 行的/usr/share/php/PEAR/Dependency2.php 中调用未定义的方法 PEAR_Registry::packageinfo()

PEAR 版本:1.9.2 和 php-pear 安装包.

PEAR Version : 1.9.2 and php-pear package installed.

推荐答案

PEAR 1.9.2 已经过时并且已经无法使用更新的 pear 服务器基础架构进行修复.

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 :)

通过 go-pear.phar 安装新梨 并确保您拥有 pear 版本 1.9.4 然后强制 pear 使用

Install a new pear via go-pear.phar and make sure you have pear version 1.9.4 and then force pear to ignore it's old cache files using

sudo pear install --force --alldeps phpunit/phpunit


摆脱老梨:

sudo apt-get purge php5-pear

现在

which pear

应该导致找不到命令.如果它仍然存在,请删除/usr/share/php 中的二进制文件和相关的 php 类.

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.

根据您的控制台历史,我想说您没有安装具有 sudo 权限的新 pear,因此它位于/home/或/usr/local/而不是在默认系统位置.

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.

只要你没关系

  • 摆脱老梨
  • 将您的 php.ini include_path 更改为新的 pear 安装位置

相关文章