2

I'm trying to retrieve the PHP version on the remote server with fabric, but when I execute my command in fabric it returns me : /bin/bash: php: command not found.

When I connect via ssh on the server then try php -v it returns me the php version. but when I try ssh user@host 'php -v' I have the same error than fabric ( /bin/bash: php: command not found)

I think my problem comes from the environment variable right? Is there a way to load the proper env variable so my command doesn't fail in fabric?

pwnsauce
  • 416
  • 4
  • 14
  • is there a difference between `ssh user@host env` and running `env` in an interactive shell? – Simon Fraser May 12 '16 at 14:01
  • 1
    Have you tried to call php with its absolute path? – zezollo May 12 '16 at 14:05
  • @SimonFraser yes, `ssh user@host env` has less value than just in `env` after loggin with ssh @zezollo I tried to find the absolute path but i didn't succeed. shouldn't it be /bin/bash/php ? – pwnsauce May 12 '16 at 15:27
  • It depends on your OS. Though I wouldn't expect it to be `/bin/bash/php`. When you're connected to your server, you should be able to use `whereis php` to find its absolute path. (`whereis` is installed on FreeBSD and on Ubuntu linux at least). – zezollo May 12 '16 at 15:56
  • 1
    Possible duplicate of http://stackoverflow.com/questions/216202/why-does-an-ssh-remote-command-get-fewer-environment-variables-then-when-run-man though – Simon Fraser May 12 '16 at 21:27

0 Answers0