SSH与PHP的连接 [英] ssh connection with php

查看:220
本文介绍了SSH与PHP的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我已经写了ssh与php连接的代码.但是它没有响应结果.
请您介意帮助我吗?
代码是这个

Hi everybody,
I have written code of ssh connection with php. But it do not response result.
Please would u mind to help me?
The code is this

?php
$con = ssh2_connect("192.168.8.35", 22);
ssh2_auth_password($con,"root","root123");

if(ssh2_sftp($con))
{
echo "connected to 192.168.8.35";
}
else
{
echo "not connected";
}
?

推荐答案

con = ssh2_connect("192.168.8.35",22); ssh2_auth_password(
con = ssh2_connect("192.168.8.35", 22); ssh2_auth_password(


con,"root","root123"); if(ssh2_sftp(
con,"root","root123"); if(ssh2_sftp(


con)) { 回显已连接到192.168.8.35"; } 别的 { 回显未连接"; } ?
con)) { echo "connected to 192.168.8.35"; } else { echo "not connected"; } ?


这篇关于SSH与PHP的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆