php 通过 PEAR 安装 PHPUnit
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2006626/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing PHPUnit via PEAR
提问by Ondrej Slinták
I have problems installing PHPUnit 3.4.6via PEAR 1.9.0. After I discover channel pear.phpunit.deand try to use one of following commands:
我在通过PEAR 1.9.0安装PHPUnit 3.4.6 时遇到问题。在我发现频道pear.phpunit.de并尝试使用以下命令之一后:
pear install phpunit/PHPUnit
pear install --alldeps phpunit/PHPUnit
pear install --onlyreqdeps phpunit/PHPUnit
梨安装phpunit/PHPUnit
梨安装 --alldeps phpunit/PHPUnit
梨安装--onlyreqdeps phpunit/PHPUnit
it fails, giving me following error:
它失败了,给了我以下错误:
No releases available for package "pear.phpunit.de/PHPUnit"
install failed
没有可用于包“pear.phpunit.de/PHPUnit”的版本
安装失败
I found several threads from people with the same problem, but upgrading PEAR to the newest version usually worked for them. Also there seems to be close to no tutorials for installing PHPUnit for Windows.
我从有同样问题的人那里找到了几个线程,但是将 PEAR 升级到最新版本通常对他们有用。此外,似乎几乎没有安装适用于 Windows 的 PHPUnit 的教程。
EDIT:
编辑:
I've also tried to change prefered_state to beta; didn't help.
我也尝试将 preferred_state 更改为 beta;没有帮助。
I've also tried to get list of all available packages:
我还尝试获取所有可用软件包的列表:
pear remote-list -c phpunit
梨远程列表 -c phpunit
It gives me another error:
它给了我另一个错误:
Cannot download non-http URL "/c/categories.xml"
无法下载非 http 网址“/c/categories.xml”
回答by cell
I had the same problem, try:
我遇到了同样的问题,请尝试:
pear clear-cache
回答by Davide
I had the same problem yesterday, and solved it by updating the channels
我昨天遇到了同样的问题,通过更新频道解决了
pear clear-cache
pear update-channels
before trying to install phpUnit.
在尝试安装 phpUnit 之前。
Hope this helps.
希望这可以帮助。
回答by KARASZI István
It simply installs me when I type:
它只是在我输入时安装我:
pear channel-discover pear.phpunit.de
pear install --onlyreqdeps phpunit/PHPUnit
Maybe there is a problem with the versions, you may set the preferred_stateof the pear packages to different than stable:
也许版本有问题,您可以将pear 包的preferred_state设置为与stable不同:
pear config-set preferred_state beta
回答by Mahesh
Please follow these steps:
请按照以下步骤操作:
- 1.
pear config-set auto_discover 1- 1.
pear config-set auto_discover 1- 2.
pear install pear.phpunit.de/PHPUnit-> here I got: installation failed.
- 2.
pear install pear.phpunit.de/PHPUnit-> 我得到:安装失败。
- 3. Try:
pear clear-cache-> executed successfully
- 3.尝试:
pear clear-cache->执行成功
- 4.
pear update-channels-> executed successfully
- 4.
pear update-channels-> 执行成功
- 5.
pear install pear.phpunit.de/PHPUnit-> successfully executed.
- 5.
pear install pear.phpunit.de/PHPUnit-> 成功执行。
回答by Shiv Deepak
I had the same problem. this worked for me:
我有同样的问题。这对我有用:
sudo pear clear-cache
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
pear install --alldeps phpunit/PHPUnit
回答by catsby
What is the full error message output? It failed for me until I installed using the --alldepsoption and ran pear channel-discover pear.symfony-project.com
完整的错误消息输出是什么?在我使用该--alldeps选项安装并运行之前,它对我来说失败了pear channel-discover pear.symfony-project.com
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear install --alldeps phpunit/PHPUnit
回答by catsby
Since 2014-12-31 PEAR Installer was no longer the only installation method for PHPUnit See here : https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method
自 2014-12-31 PEAR Installer 不再是 PHPUnit 的唯一安装方法请参见此处:https: //github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method
回答by thelem
I tried
我试过
pear update-channels
as suggested by Davide above, but that gave me the error
正如上面 Davide 所建议的,但这给了我错误
Channel pear.php.net does not support xml-rpc method channel.listAll
For some reason, it worked when I ran
出于某种原因,当我跑步时它起作用了
pear channel-update pear.phpunit.de
回答by quickshiftin
You need to also discover the ezcomponents channel using pear channel-discover components.ez.no
您还需要使用以下方法发现 ezcomponents 频道 pear channel-discover components.ez.no
In total:
总共:
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear install --alldeps phpunit/PHPUnit
You can have a quick sanity check is to run phpunit from the CLI and see if the command is recognized.
您可以快速检查是否从 CLI 运行 phpunit 并查看该命令是否被识别。
UPDATE
更新
Seems they've moved symfony, I just did a fresh install today, here's the new channel
似乎他们已经移动了 symfony,我今天刚刚进行了全新安装,这是新频道
sudo pear channel-discover pear.symfony.com
回答by U4EA
I had struggled for ages with getting ZEND etc to work on XAMPP on Windows Vista. For reference, this is how I solved it: -
我一直在努力让 ZEND 等在 Windows Vista 上运行 XAMPP。作为参考,我是这样解决的:-
Couldn't update PEAR then I realised it's default path setting were wrong, I correct this guide...
无法更新 PEAR 然后我意识到它的默认路径设置是错误的,我更正了本指南...
http://david-franklin.net/programming/installing-pear-phpunit-on-windows/
http://david-franklin.net/programming/installing-pear-phpunit-on-windows/
Then I managed to get PHPUNIT installed with the pear clear_cachecommand thanks to this thread then ran "pear install phpunit/PHPunit".
然后,pear clear_cache由于这个线程,我设法使用命令安装了 PHPUNIT,然后运行“pear install phpunit/PHPunit”。
I hope what I wrote above will serve as a quick code for those in a similar predicament (it took me 2 whole days to get it working!!!)
我希望我上面写的内容可以作为那些处于类似困境的人的快速代码(我花了整整 2 天才让它工作!!!)

