Installing PHPUnit via PEAR

PhpPhpunitPear

Php Problem Overview


I have problems installing PHPUnit 3.4.6 via PEAR 1.9.0. After I discover channel pear.phpunit.de and try to use one of following commands:

> pear install phpunit/PHPUnit > > pear install --alldeps phpunit/PHPUnit > > pear install --onlyreqdeps phpunit/PHPUnit

it fails, giving me following error:

> No releases available for package > "pear.phpunit.de/PHPUnit" > > install failed

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.

EDIT:

I've also tried to change prefered_state to beta; didn't help.

I've also tried to get list of all available packages:

> pear remote-list -c phpunit

It gives me another error:

> Cannot download non-http URL "/c/categories.xml"

Php Solutions


Solution 1 - Php

I had the same problem, try:

pear clear-cache

Solution 2 - Php

I had the same problem yesterday, and solved it by updating the channels

pear clear-cache
pear update-channels

before trying to install phpUnit.

Hope this helps.

Solution 3 - Php

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_state of the pear packages to different than stable:

pear config-set preferred_state beta

Solution 4 - Php

Please follow these steps:

    1. pear config-set auto_discover 1
    1. pear install pear.phpunit.de/PHPUnit

    -> here I got: installation failed.

    1. Try: pear clear-cache -> executed successfully
    1. pear update-channels -> executed successfully
    1. pear install pear.phpunit.de/PHPUnit -> successfully executed.

Solution 5 - Php

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

Solution 6 - Php

What is the full error message output? It failed for me until I installed using the --alldeps option and ran 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

Solution 7 - Php

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

Solution 8 - Php

I tried

pear update-channels

as suggested by Davide above, but that gave me the error

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 

Solution 9 - Php

You need to also discover the ezcomponents channel using 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.

UPDATE

Seems they've moved symfony, I just did a fresh install today, here's the new channel

sudo pear channel-discover pear.symfony.com

Solution 10 - Php

I have same problem with phpunit instalation. Try using Synaptic package manager for PHPUnit instalation.

sudo pear install pear # upgrade pear first

#install php unit with synaptic manager

phpunit --version # get version of phpunit

Solution 11 - Php

I had struggled for ages with getting ZEND etc to work on XAMPP on Windows Vista. For reference, this is how I solved it: -

Couldn't update PEAR then I realised it's default path setting were wrong, I correct this guide...

http://david-franklin.net/programming/installing-pear-phpunit-on-windows/

Then I managed to get PHPUNIT installed with the pear clear_cache command thanks to this thread then ran "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!!!)

Solution 12 - Php

I had an issue with not having a required dependency YAML, so got a warning each time.

Try pear channel-discover pear.symfony.com pear install pear.symfony.com/Yaml

then run the download again

pear install --alldeps pear.phpunit.de/PHPUnit

Solution 13 - Php

First off all xampp should be installed to C:\xampp

Open a command prompt and go to C:\xampp\php

Type the following commands in to the cmd

pear update-channels" (updates channel definitions)

pear upgrade (upgrades all existing packages and pear)

pear channel-discover components.ez.no (this is needed for PHPUnit)

pear channel-discover pear.symfony-project.com (also needed by PHPUnit)

pear channel-discover pear.phpunit.de (This IS phpunit)

pear install --alldeps phpunit/PHPUnit (installs PHPUnit and all dependencies)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOndrej SlintákView Question on Stackoverflow
Solution 1 - PhpcellView Answer on Stackoverflow
Solution 2 - PhpDavideView Answer on Stackoverflow
Solution 3 - PhpKARASZI IstvánView Answer on Stackoverflow
Solution 4 - PhpMaheshView Answer on Stackoverflow
Solution 5 - PhpShiv DeepakView Answer on Stackoverflow
Solution 6 - PhpcatsbyView Answer on Stackoverflow
Solution 7 - Phpuser4685543View Answer on Stackoverflow
Solution 8 - PhpthelemView Answer on Stackoverflow
Solution 9 - PhpquickshiftinView Answer on Stackoverflow
Solution 10 - PhpOzzyCzechView Answer on Stackoverflow
Solution 11 - PhpU4EAView Answer on Stackoverflow
Solution 12 - PhpGreg.ForbesView Answer on Stackoverflow
Solution 13 - PhpSamView Answer on Stackoverflow