dtja73027 2016-02-25 01:43
浏览 42
已采纳

如何使用PHP进行SFTP [重复]

This question already has an answer here:

I'm interested in trying to get SFTP working with the following PHP method: ftp_ssl_connect(host,port,timeout);

I notice that on W3CSchools (http://www.w3schools.com/php/func_ftp_ssl_connect.asp) there is the following note:

Note: This function is only available if both the ftp module and the OpenSSL support is built statically into PHP.

I am left with the question as to how to "build statically" both the "ftp module" and "OpenSSL support" into PHP. I have googled around and there seems to be very sparse information on this subject.

When I currently try to run the code from W3CSchools with legitimate credentials, I constantly get "false" returned. I can successfully SFTP in with the same credentials and port I am using with PHP, so that isn't the problem.

I realize there is another similar question on StackOverflow; however, that question does not even mention nor give an explanation as to how to use the PHP function ftp_ssl_connect() and I would still like to know how to use it and when to use it.

</div>
  • 写回答

1条回答 默认 最新

  • doucheng3811 2016-02-25 01:56
    关注

    SFTP (not to be confused with FTPS) is a tool provided by the OpenSSH suite (and other implementations) to securely transfer files over an SSH connection. It is in no way related to FTP or FTPS, which is what the function you're using is for.

    You are probably looking for https://secure.php.net/manual/en/function.ssh2-sftp.php and the other related functions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求苍穹外卖环境配置
  • ¥15 代码在keil5里变成了这样怎么办啊,文件图像也变了,
  • ¥20 Ue4.26打包win64bit报错,如何解决?(语言-c++)
  • ¥15 clousx6整点报时指令怎么写
  • ¥30 远程帮我安装软件及库文件
  • ¥15 关于#自动化#的问题:如何通过电脑控制多相机同步拍照或摄影(相机或者摄影模组数量大于60),并将所有采集的照片或视频以一定编码规则存放至规定电脑文件夹内
  • ¥20 深信服vpn-2050这台设备如何配置才能成功联网?
  • ¥15 Arduino的wifi连接,如何关闭低功耗模式?
  • ¥15 Android studio 无法定位adb是什么问题?
  • ¥15 C#连接不上服务器,