我正在使用具有ssh2扩展名的PHP 5.6创建到远程主机的SSH隧道,这是我的代码:
$connection = ssh2_connect("example.com", 22);
if (ssh2_auth_password($connection, "root", "123123")) {
if ($tunnel = ssh2_tunnel($connection, '127.0.0.1', 1080)){
//curl commands
}
}
我可以使用ssh2_exec来执行一些Linux命令,但是不能使用ssh2_tunnel创建SSH隧道,这里是错误日志:
PHP警告:ssh2_tunnel():无法从远程请求频道 主机
有人可以给我一些提示吗?
注意:
我里面有AllowTcpForwarding yes
GatewayPorts yes
/ etc / ssh / sshd_config