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 deployer@XXX.com 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 -vdisplays correct PHP version (same as
php: /usr/bin/php /usr/local/bin/php /usr/share/man/man1/php.1.gz
php5-clipackage is installed and newest version
I have also tried following things:
- running the script directly as
bash deploy.shunder 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.