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 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题
  • ¥60 高价有偿求java辅导。工程量较大,价格你定,联系确定辅导后将采纳你的答案。希望能给出完整详细代码,并能解释回答我关于代码的疑问疑问,代码要求如下,联系我会发文档
  • ¥50 C++五子棋AI程序编写
  • ¥30 求安卓设备利用一个typeC接口,同时实现向pc一边投屏一边上传数据的解决方案。