使用PHP捕获Linux终端

时间:2018-07-09 16:56:52

标签: php

我的问题是如何在php中获取终端的输出?我的意思是我想创建一个网站,用户可以在其中查看终端中发生的情况。我想“捕获终端”,然后在PHP中回显它。我不知道该如何真正地解释它,所以如果您不太了解我,请问我您不了解的内容。谢谢。

1 个答案:

答案 0 :(得分:0)

您正在使用的解决方案是“终端截屏”,即google;-)

一些解决方案:

  • 脚本和脚本重播 linux命令

    键入script /var/www/log/history_log.txt,开始记录您在shell中键入的内容

然后键入任何命令;要停止脚本,请键入exit并按[Enter]。

日志将在文件history_log.txt中可用

此处的更多信息https://www.tecmint.com/record-and-replay-linux-terminal-session-commands-using-script/ 还有https://www.linux.com/learn/using-screen-remote-interaction

  • ShowTerm

还有解决方案ShowTerm,更多信息在这里:https://www.tecmint.com/showterm-io-a-terminalshell-recording-upload-and-share-tool-for-linux/

  • tty2gif

更多信息,https://github.com/z24/tty2gif

  • 腹水

基于Web的解决方案(要安装linux工具):https://asciinema.org/