升级到 Ubuntu 14.04 后,php-pear 无法安装任何软件包。
sudo pear install --alldeps --force pear.phpunit.de/PHPUnit
downloading PHPUnit-4.0.17.tgz ...
Starting to download PHPUnit-4.0.17.tgz (509,430 bytes)
......................................................................................................done: 509,430 bytes
could not extract the package.xml file from "/build/buildd/php5-5.5.9+dfsg/pear-build-download/PHPUnit-4.0.17.tgz"
Download of "phpunit/PHPUnit" succeeded, but it is not a valid package archive
Error: cannot download "phpunit/PHPUnit"
Download failed
install failed
The packages are being downloaded but can't extract.
Run Code Online (Sandbox Code Playgroud)
我试过这个解决方案,http://cweiske.de/tagebuch/pear-php-5.5.htm 但仍然遇到同样的问题。
有人遇到过这种情况么?我需要降级到 php5.4 吗?如果是这样,如何?
更新:感谢您的快速回复。Karels 的回答解决了我的问题。只是为了完整性,通过梨安装的正确方法不再有效。从 phar 文件安装的步骤记录在:http ://phpunit.de/getting-started.html
也不再需要包含/要求 PHPunit/Runner.php 和 Autoload 等。
再次。谢谢您的帮助
获取 PHPUnit 的最简单方法是下载 PHP 存档 (PHAR),该存档将 PHPUnit 的所有必需(以及一些可选)依赖项捆绑在一个文件中。
打开终端并输入:
wget https://phar.phpunit.de/phpunit.phar # download the PHP Archive (PHAR) file
chmod +x phpunit.phar
sudo mv phpunit.phar /usr/local/bin/phpunit
Run Code Online (Sandbox Code Playgroud)
https://phar.phpunit.de/上有许多不同版本的 phpunit.phar 。如果您使用第一个命令,它将选择并下载最新版本的 phpunit.phar。