问题
I am trying to install PHPUnit_Selenium
using the command
pear install phpunit/PHPUnit_Selenium
The version of pear that i am running is 1.9.4. The above command returned
Attempting to discover channel "phpunit"... Attempting fallback to https instead of http on channel "phpunit"... unknown channel "phpunit" in "phpunit/PHPUnit_Selenium" invalid package name/package file "phpunit/PHPUnit_Selenium" install failed
Searching google I found this (a few times) as a suggestion. So I tried
pear channel-discover pear.phpunit.de
and
sudo pear channel-discover pear.phpunit.de
(incase it made a difference)
previous command returned
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 403 Forbidden ( Forefront TMG denied the specified Uniform Resource Locator (URL). ) )) 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" (Connection to `pear.phpunit.de:443' failed: Operation timed out))
What do I need to do to install PHPUnit_Selenium?
回答1:
Maybe you need to specify a proxy for pear to route it's traffic through. Try something like:
$ sudo pear config-set http_proxy http://foo.bar/
$ sudo pear channel-discover pear.phpunit.de
$ sudo pear install phpunit/PHP_Selenium
回答2:
The PEAR channel for phpunit has been discontinued as of the end of April 2014, to install PHPUnit and PHPUnit_Selenium install via composer.
Configure your composer.json to the specific package version (See PHPUnit_Selenium)
In your composer.json
file, write:
{
"require": {
"phpunit/phpunit": "*",
"phpunit/phpunit-selenium": ">=1.3.3"
}
}
Try the following command:
$ composer install
回答3:
Use "pear.phpunit.de" instead of "phpunit"
sudo pear install pear.phpunit.de/PHPUnit_Selenium
Phpunit require curl to be installed,if you didn't install it try this:
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
sudo service apache2 restart
回答4:
Installing phpunit-selenium package in Ubuntu Trusty is as easy as running:
apt-get install phpunit-selenium
来源:https://stackoverflow.com/questions/20686355/cannot-install-pear-install-phpunit-phpunit-selenium