1

I was trying to install PHPUnit following the step-by-step guide in the Getting Started page.

However, when I try phpunit --version in terminal, I receive /usr/local/bin/phpunit: Permission denied.

Trying sudo phpunit --version the error is sudo: phpunit: command not found.

I already tried execute:

$ cd /usr/local/bin
$ ./phpunit --version

The error is bash: ./phpunit: Permission denied and with sudo I get command not found again.

Finally, using php before the command like php phpunit --version I get the expected result, that is PHPUnit 5.0.8 by Sebastian Bergmann and contributors.

I'm considering it a strange behaviour because I already installed PHPUnit in other machines and all worked fine.

So, someone knows why PHPUnit just works with a php before?

Some important information:

Ubuntu 14.04 LTS

PHP 5.6.14

PHPUnit 5.0.8

echo $PATH returns /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin that includes /usr/local/bin

ls -l in /usr/local/bin directory gives me -rw-rw-r-- 1 root root 2766207 Out 23 04:50 phpunit

James
  • 681

1 Answers1

0

As pointed by @ilkhd in the comments, the problem is inded with permission of the file.

Then, the solution is just:

$ cd /usr/local/bin
$ sudo chmod +x phpunit
James
  • 681