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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵