Home » Php » php – PHPUnit CLI not available after PEAR install

php – PHPUnit CLI not available after PEAR install

Posted by: admin July 12, 2020 Leave a comment

Questions:

I’ve installed PHPUnit on my OS X Snow Leopard box using the following command:

sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit

I would expect that the phpunitCLI command would be available after that, but it isn’t. I’ve looked in /usr/local/bin and /usr/lib/php/PHPUnit but can’t find anything that looks like a CLI.

Can anyone tell me how to get the CLI up and running?

How to&Answers:

I had the same problem, after checking installation page and running below commands, it started working. Just make sure to remove it before running them.

sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
sudo pear install phpunit/PHPUnit

Answer:

I had the same problem, I received no errors after the pear installation, but some directories and files where installed (under /usr/lib/php/pear) and others missing (I had no phpunit.sh file among others).

My setup: OSX Lion 10.7.2 + PHP 5.3.6 + PEAR 1.9.2.

I can’t really say for sure what the problem was, but I found that the PEAR installer was not up to date, so I upgraded it (to 1.9.4) with:

sudo pear upgrade pear

After that, following the phpunit manual, I typed:

sudo pear config-set auto_discover 1

So yo don’t need to add the channels for every package and dependency. And then:

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

And voilà, everything is working finally!

Answer:

Do not forget to clear the cache after discovering the channels:

sudo pear clear-cache

I couldn’t install anything with PEAR and clearing the cache worked for me