I have my app published in a server and
I ssh into the machine, cd into the home directory and run
php -v
then I got PHP 7.4.5 (cli) (built: Apr 18 2020 01:11:34) ( NTS )
If I run the same command over SSH
ssh MY_USER@SERVER_IP "php -v"
then I got PHP 5.6.22-2 (cli)
I'm trying to trigger a composer install
remotely but it fails because of
the php version.
I'd like to run the command with php 7.4 of course.
Any tips?
Thanks
Ps. If I run 'whoami' I get the same user.
As you can check where the php cli is running from with the whereis
command, you can do the same for the composer too. The where is command returns with the paths of the scripts.
So when you say whereis php
, you will see something like this as response:
php: /usr/bin/php /usr/share/php /usr/local/php7/bin/php
If you wanna use the php 7.4.5, then you should just figure out, where the path of the php 7.4.5 is located. For that you can ssh into the machine cd to the home directory and execute whereis php
. Then you get a location what you can use with the other command too.
Now we need to know where the composer is running from:
whereis composer
composer: /usr/bin/composer
Finally we can execute the desired command, which is one of the path of the php script and the path of the composer script. For example:
/usr/bin/php /usr/bin/composer
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.10.5 2020-04-10 11:44:22
Usage:
command [options] [arguments]
That's it.