I am trying to run CLI commands in PHP but on a different server. In order to run the command on the other server I am using the linux ssh command. In order to run the CLI command in PHP I am using exec().
This works...
$output = exec('cut -d: -f1 /etc/passwd'); //works!
This works from the command line of one server to another...
ssh my.otherserver.com "date"
But, when I try to do this in PHP it does not work...
$output = exec('ssh my.otherserver.com "date"'); //does not work!
Is what I am trying to do possible? How do I do this? Thanks in advance.