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

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.

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

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料