我试图通过使用此命令告诉pear
在哪里找到PHPUnit:
sudo pear channel-discover pear.phpunit.de
输出结果为:
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
)))
我尝试了以下命令:
sudo pear channel-update pear.php.net
sudo pear upgrade-all
然后我再次运行channel-discover
命令。我得到了如上所示的相同错误。
我甚至试过这些命令:
sudo pear config-set auto_discover 1
输出:
config-set succeeded
然后我尝试了这个命令:
sudo pear install pear.phpunit.de/PHPUnit
输出:
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
所以我访问了此链接:https://pear.phpunit.de/channel.xml
并显示410 gone
错误。还有其他替代方法吗?
答案 0 :(得分:17)
你不能再使用pear安装phpunit了: https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method
但您仍然可以使用phar文件安装它: https://phpunit.de/getting-started.html
或使用作曲家: https://phpunit.de/manual/current/en/installation.html#installation.composer
答案 1 :(得分:3)
现在大多数人只是作曲家。但是既然你似乎在Ubuntu上,你可以随时做到:
sudo apt-get install phpunit
答案 2 :(得分:0)
下载为我工作的phar档案:
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
答案 3 :(得分:0)
对于RHEL发行版(CentOS / Fedora / etc)上尚未使用作曲家的人,可以使用YUM安装phpunit:
yum install phpunit