I have some php packages installed globally using
php composer within a script
sudo -u me composer global require "phpmd/phpmd"
I want to find the path of these globally installed php packages. When I run
which phpmd as user
me I get the full path.
However when I try and run the command as
sudo I get nothing. I think this is because composer has been added globally and is in my user
PATH while it is not present in sudo's
Instead I have tried
path="$(sudo -u me which phpcs)"
But this also fails. However it succeeds for any program not installed through composer. How can I find the globally installed php packages through composer as
sudo (su's) path