doueta6642 2013-10-09 15:05 采纳率: 0%
浏览 83
已采纳

SFTP未连接到远程服务器

I am trying to connect to a remote SFTP server using PHP. My code works fine when I connect to a local SFTP account but it times out for remote host. I have made sure through FTP client that host information is correct and its connecting fine.

I am using phpseclib library and my three line code is below.

require_once("phpseclib/Net/SFTP.php");

$sftp = new Net_SFTP('remote_host_IP');
var_dump($sftp->login('<username>', '<password>'));

It returns false (meaning not connected).

What I have done

  • I have whitelisted script in mod_security just in case its blocking that.
  • I have tried same script on my local computer and it connects successfully to remote SFTP.

Any valuable hint please?

  • 写回答

2条回答 默认 最新

  • dovhpmnm31216 2013-10-18 13:32
    关注

    This might help others. You need to make sure TCP_OUT port is open on your remote server to make it work.

    Thanks for the help!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮