使用php在远程服务器上执行命令

时间:2013-10-11 14:37:47

标签: php ssh ftp

我需要在我的php项目中执行此命令,首先需要文件access.log并显示它,然后过滤下一个代码:

cat access.log |grep "2013-10-09" |grep Receive |grep from |grep 8386|wc -l

我知道我需要建立与SSH服务的连接,但我不知道如何执行命令转到access.log并打开它。我真的需要你的帮助!

谢谢!

1 个答案:

答案 0 :(得分:0)

欢迎您熟悉ssh2_connect()ssh2_exec()和所有ssh2_函数系列。

试试这里: http://php.net/manual/en/function.ssh2-connect.php http://www.php.net/manual/en/function.ssh2-exec.php

相关问题