I'm trying to run an executable via the cli, like so:
phpunit DefaultTest
but i get "command not found" so i have to do:
/usr/lib/php/bin/phpunit DefaultTest
which works, how do i set it so i only have to use the executable name?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityI'm trying to run an executable via the cli, like so:
phpunit DefaultTest
but i get "command not found" so i have to do:
/usr/lib/php/bin/phpunit DefaultTest
which works, how do i set it so i only have to use the executable name?
You'll have to append /usr/lib/php/bin to your $PATH environment variable. The best way to do this is to edit .bashrc or .profile and add /usr/lib/php/bin at the end of the $PATH like in the example below.
Example:
.profile:
...
...
PATH="/usr/lib/php/bin:$PATH"
You can also symlink to a place in the standard path. If you need to execute it outside of shell or if it had to be available for all users
sudo ln -s /usr/lib/php/bin/phpunit /usr/local/bin
/usr/local/bin
is in the path and is the common location of user installed binaries, so its contents are available for execution systemwide.