dongyizhuang0134 2018-08-04 09:44
浏览 459
已采纳

Laravel SSH连接

I have a question regarding a task that I want to accomplish. I have a website whose back-end is written in laravel 5 and using mysql as a database. On the website dashboard there is tab named status. What I wanted to do is that when I click on the status tab it will fetch a server IP from the table that is already present in the database. Make ssh connection on that server IP, execute a bash command on the remote terminal and show the output of the command on the dashboard. Is it possible to do in laravel? I have seen 2 packages that are available in laravel for ssh connection. One is ssh by laravelcollective and other is envoy by laravel but i am unable to figure out how they will accomplish this task. Any help in this regard would be highly appreciated. Thanks.

  • 写回答

1条回答 默认 最新

  • doubi4491 2018-08-04 09:51
    关注

    One way to accomplish this is by using the ssh2_connect which allows you to create the connection and then you can execute commands and retrieve the results in via callbacks

    Here you have the full documentation which comes with nice examples on everything I said before.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?