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


Execute a command on a remote server using php

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

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

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

谢谢!

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

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