dongzecai0684 2017-01-01 18:15
浏览 53

无法使用phpseclib连接到ftp。*****。com:22

I am new to phpseclib and I am facing the same issue as this old Stack Overflow post.

<?php
set_include_path('/home/eibahhxo/public_html/EibaMed/phpseclib');
//echo get_include_path();
ini_set('display_errors', 'On'); ini_set('html_errors', 0); error_reporting(-1);
include(get_include_path().'/Net/SFTP.php');

$sftp = new Net_SFTP('ftp.*****.com',22);
if (!$sftp->login('username', 'password')) { //if you can't log on...
print_r($sftp->getSFTPErrors());
   exit('sftp Login Failed');
}

$output = $sftp->put('/inbound/00017', '/00017');
?>

While making this code, it throws this following error

Notice: Cannot connect to ftp.*****.com:22. Error 110. Connection timed out in /home/eibahhxo/public_html/EibaMed/phpseclib/Net/SSH2.php on line 1046 Array ( ) sftp Login Failed

How can I resolve this?

  • 写回答

1条回答 默认 最新

  • dqz30992 2018-07-02 23:12
    关注

    First, make sure the service is actually running with no errors. Check the error log

    Second, check that your SFTP server is listening on port 22 (look for LISTEN or LISTENING):
    netstat -na | find ":22" (on linux, use grep instead of find)

    Third, check your firewall is not blocking port 22. Depending on your setup, you may have to check both the server firewall and the router or VPN firewall

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog