无法通过 PEAR 安装 PHPUnit,需要 PEAR 安装程序 >= 1.9.2,无法从 1.9.0 升级 PEAR

发布于 2024-11-18 20:20:47 字数 3054 浏览 2 评论 0原文

我阅读了其他 PHPUnit 安装问题,但没有取得任何成功。我的 PEAR 安装发生了什么?

$ sudo pear update-channels
Updating channel "components.ez.no"
Channel "components.ez.no" is up to date
Updating channel "doc.php.net"
Channel "doc.php.net" is up to date
Updating channel "pear.php.net"
Channel "pear.php.net" is up to date
Updating channel "pear.phpunit.de"
Channel "pear.phpunit.de" is up to date
Updating channel "pear.symfony-project.com"
Channel "pear.symfony-project.com" is up to date
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
$ sudo pear upgrade pear
Nothing to upgrade
$ sudo pear install phpunit/PHPUnit
phpunit/PHPUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/DbUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.1), installed version is 1.9.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.9.0
phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
No valid packages found
install failed
$ pear list
Installed packages, channel pear.php.net:
=========================================
Package          Version  State
Archive_Tar      1.3.7    stable
Cache_Lite       1.7.11   stable
Console_Getopt   1.3.1    stable
HTTP_Request2    2.0.0RC1 beta
Net_URL2         0.3.1    beta
PEAR             1.9.3    stable
Structures_Graph 1.0.4    stable
XML_RPC2         1.1.1    stable
XML_Util         1.2.1    stable
greg@ubuntu:~$ pear -V
PEAR Version: 1.9.0
PHP Version: 5.3.6
Zend Engine Version: 2.3.0
Running on: Linux ubuntu 2.6.32-32-generic-pae #62-Ubuntu SMP Wed Apr 20 22:10:33 UTC 2011 i686

pear list 报告已安装 1.9.3,pear -V 报告已安装 1.9.0!?!

更新尝试了 KingCrunch 建议。

$ sudo pear install -f pear
[sudo] password for greg: 
downloading PEAR-1.9.3.tgz ...
Starting to download PEAR-1.9.3.tgz (295,774 bytes)
...........................done: 295,774 bytes
install ok: channel://pear.php.net/PEAR-1.9.3
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
$ pear -V
PEAR Version: 1.9.0
PHP Version: 5.3.6
Zend Engine Version: 2.3.0
Running on: Linux ubuntu 2.6.32-32-generic-pae #62-Ubuntu SMP Wed Apr 20 22:10:33 UTC 2011 i686

I read the other PHPUnit installation questions but haven't had any success. What is going on with my PEAR install?

$ sudo pear update-channels
Updating channel "components.ez.no"
Channel "components.ez.no" is up to date
Updating channel "doc.php.net"
Channel "doc.php.net" is up to date
Updating channel "pear.php.net"
Channel "pear.php.net" is up to date
Updating channel "pear.phpunit.de"
Channel "pear.phpunit.de" is up to date
Updating channel "pear.symfony-project.com"
Channel "pear.symfony-project.com" is up to date
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
$ sudo pear upgrade pear
Nothing to upgrade
$ sudo pear install phpunit/PHPUnit
phpunit/PHPUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/DbUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.1), installed version is 1.9.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.9.0
phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.2), installed version is 1.9.0
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0
No valid packages found
install failed
$ pear list
Installed packages, channel pear.php.net:
=========================================
Package          Version  State
Archive_Tar      1.3.7    stable
Cache_Lite       1.7.11   stable
Console_Getopt   1.3.1    stable
HTTP_Request2    2.0.0RC1 beta
Net_URL2         0.3.1    beta
PEAR             1.9.3    stable
Structures_Graph 1.0.4    stable
XML_RPC2         1.1.1    stable
XML_Util         1.2.1    stable
greg@ubuntu:~$ pear -V
PEAR Version: 1.9.0
PHP Version: 5.3.6
Zend Engine Version: 2.3.0
Running on: Linux ubuntu 2.6.32-32-generic-pae #62-Ubuntu SMP Wed Apr 20 22:10:33 UTC 2011 i686

pear list reports 1.9.3 installed, pear -V reports 1.9.0!?!

Update Tried KingCrunch suggestion.

$ sudo pear install -f pear
[sudo] password for greg: 
downloading PEAR-1.9.3.tgz ...
Starting to download PEAR-1.9.3.tgz (295,774 bytes)
...........................done: 295,774 bytes
install ok: channel://pear.php.net/PEAR-1.9.3
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
$ pear -V
PEAR Version: 1.9.0
PHP Version: 5.3.6
Zend Engine Version: 2.3.0
Running on: Linux ubuntu 2.6.32-32-generic-pae #62-Ubuntu SMP Wed Apr 20 22:10:33 UTC 2011 i686

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

从来不烧饼 2024-11-25 20:20:47

您的计算机上基本上安装了 2 个 pear,“pear 升级”命令会更新另一个,而不是它本身。

我假设您正在运行的 pear 版本已通过 ubuntu 的 apt 安装。

使用 apt 找出它的安装位置(在 Debian/Ubuntu 上):

$ dpkg -L php-pear
...
/usr/share/php/PEAR.php
...
/usr/bin/pear

现在让我们看看 pear 将文件安装到哪里:

$ pear config-get php_dir
/usr/share/php

在我的机器上,它是相同的 - 但可能不是在你的机器上,这是问题。通过设置 php_dir 以及 bin_dir 来修复此问题:

$ pear config-set php_dir /usr/share/php
$ pear config-set bin_dir /usr/bin

或者,删除 ubuntu pear 并从 http://pear.php.net/go-pear.phar

You basically have 2 pear installations on your machine, and the "pear upgrade" command updates the other one, not itself.

I assume that the pear version you're running has been installed via ubuntu's apt.

Find out where it has been installed with apt (on Debian/Ubuntu):

$ dpkg -L php-pear
...
/usr/share/php/PEAR.php
...
/usr/bin/pear

Now let's see where pear installs the files to:

$ pear config-get php_dir
/usr/share/php

On my machine, it is the same - but probably not on yours, which is the problem. Fix it by setting the php_dir, as well as the bin_dir:

$ pear config-set php_dir /usr/share/php
$ pear config-set bin_dir /usr/bin

Alternatively, remove the ubuntu pear and install it freshly from http://pear.php.net/go-pear.phar

梦境 2024-11-25 20:20:47

如果你对梨的部分不成功,请看看这个。

wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit

参考:http://phpunit.de/manual/3.7/en/installation.html

下载PHAR后您也可以立即使用;

wget https://phar.phpunit.de/phpunit.phar
php phpunit.phar

If you are not successful with the pear part have a look at this.

wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit

ref: http://phpunit.de/manual/3.7/en/installation.html

You can also immediately use the PHAR after you have downloaded it;

wget https://phar.phpunit.de/phpunit.phar
php phpunit.phar
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文