Execute a shell command through ssh using PHP

后端 未结 3 1042
逝去的感伤
逝去的感伤 2020-12-17 07:10

I\'m trying to execute a simple shell command and print the result on a web page but the results are empty. Below is one bit of code I found but nothing has worked thus far.

3条回答
  •  别那么骄傲
    2020-12-17 07:36

    You're missing the -p option before the port number:

    $str = "ssh -p $port $username@$server $command";
    

提交回复
热议问题