I want to use .sh script for deployment of my app. That script is on my home server (Ubuntu 15.10 Server), marked as executable. Access to this script is done through ssh, using this tutorial, I have set up ssh login, that runs that script. So basically I just call ssh [email protected] someArguments
and it runs my script with someArguments
as parameters. The user deployer
has uid=0, so its basically root
(this will be changed in the future, I have set it only to eliminate permissions problems until it works fine).
And here is where the things get tricky. The script reports /usr/bin/env: php: No such file or directory
at command /bin/composer install
(using Composer). Things are more weird the more I look on that script. Before this line, there is also called /bin/composer self-update
and /bin/composer -V
, which both runs correctly and displays correct output.
I have checked following things:
/usr/bin/env php -v
displays correct PHP version (same as/usr/bin/php -v
)whereis php
displaysphp: /usr/bin/php /usr/local/bin/php /usr/share/man/man1/php.1.gz
php5-cli
package is installed and newest version$PATH
contains/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
which env
displays/usr/bin/env
I have also tried following things:
- running the script directly as
bash deploy.sh
under root (since it is same as that user) - works perfectly without errors - running failing commands directly - also perfectly without errors
So this seems to me as very specific case, why this command does not work. I spent 12 hours of debugging it and I am out of ideas here.
P.S.: Similar error (/usr/bin/env: node: No such file or directory
) occurs when there is bower install
(using Bower), but not when running npm install
(using NPM).
sh deploy
instead ofbash deploy
(maybe some bashism). How did you check the "following things"? I recommend to check them in the script, so that you can discover eventual overrides and sanitations of envs.sh deploy
andbash deploy
both gives same results/usr/bin/env > environment.txt