0

I am trying to setup deployer php on a shared server. And having trouble running php remotely on the server.

The server is running php 7.0.6 for normal http requests. And if I SSH in via terminal and run php -v on the remote server I get:

# php -v
PHP 7.0.6 (cli) (built: May  2 2016 02:11:49) ( NTS )

this seems good to go but if I run a remote command from my local machine:

$ ssh  'user@domain.com' 'php -v'
PHP 5.3.28 (cli) (built: Mar 29 2014 12:18:37) 

obviously the remote command is not using the right php version. I found the version is set in the .bash_porfile:

export PATH=/usr/local/lib/crucial-php/php-7.0.600/bin:$PATH

but I don't know how to get the ssh remote command to respect the .bash_profile. Is there anyway to get the remote command to use the modified PATH without forcing it with source ~/.bash_profile

Ryan
  • 414
  • 1
  • 6
  • 16
  • 1
    Run `which php` instead to shed some light into the situation. Most likely there's a different user used for the two sessions. – apokryfos Mar 05 '17 at 07:37

1 Answers1

0

This turned out to be pretty simple, after reading this post:

Why does an SSH remote command get fewer environment variables then when run manually?

I copied the PATH var into my ~/.bashrc file and it worked like a charm.

Community
  • 1
  • 1
Ryan
  • 414
  • 1
  • 6
  • 16