Issues while installing pear.phpunit.de/PHPUnit

梦想与她 提交于 2019-12-18 19:04:35

问题


I'm trying to tell pear that where to find PHPUnit by using this command:

sudo pear channel-discover pear.phpunit.de

The output was:

Discovering channel pear.phpunit.de over http:// failed with message: channel-add: Cannot open "http://pear.phpunit.de/channel.xml" (File http://pear.phpunit.de:80/channel.xml not valid (received: HTTP/1.1 410 Gone
))
Trying to discover channel pear.phpunit.de over https:// instead
Discovery of channel "pear.phpunit.de" failed (channel-add: Cannot open "https://pear.phpunit.de/channel.xml" (File https://pear.phpunit.de:443/channel.xml not valid (received: HTTP/1.1 410 Gone
)))

I tried the following commands:

sudo pear channel-update pear.php.net
sudo pear upgrade-all

Then I ran channel-discover command again. I got same error as shown above.
I even tried these commands:

sudo pear config-set auto_discover 1

Output:

config-set succeeded

Then I tried this command:

sudo pear install pear.phpunit.de/PHPUnit

Output:

Attempting to discover channel "pear.phpunit.de"...
Attempting fallback to https instead of http on channel "pear.phpunit.de"...
unknown channel "pear.phpunit.de" in "pear.phpunit.de/PHPUnit"
invalid package name/package file "pear.phpunit.de/PHPUnit"
install failed  

So I visited this link: https://pear.phpunit.de/channel.xml and it displayed 410 gone error. Is there any other alternate way to do this?


回答1:


You can't install phpunit using pear anymore: https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method

But you can still install it using the phar file: https://phpunit.de/getting-started.html

Or using composer: https://phpunit.de/manual/current/en/installation.html#installation.composer




回答2:


Most people just composer nowadays. But since you seem to be on Ubuntu you can always do:

sudo apt-get install phpunit



回答3:


Download the phar archive worked for me:

https://github.com/Mayflower/PHP_CodeBrowser

wget https://github.com/mayflower/PHP_CodeBrowser/releases/download/1.1.1/phpcb-1.1.1.phar
mv phpcb-1.1.1.phar /usr/local/bin/phpcb
chmod a+x /usr/local/bin/phpcb

phpcb --version
PHP_CodeBrowser version 1.1.1



回答4:


For those on RHEL distros (CentOS/Fedora/ etc) and not yet using composer, you can install phpunit using YUM:

yum install phpunit


来源:https://stackoverflow.com/questions/28455906/issues-while-installing-pear-phpunit-de-phpunit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!