简体   繁体   English

PHP sftp + fopen 与 ssh2_scp_send 的比较

[英]PHP sftp + fopen compared to ssh2_scp_send

I wanted to if there is any real difference using PHP sftp for file open like shown here and with ssh2_scp_send I am planning on uploading multiple files per php session and want to not spend to much time in uploading the files.我想知道使用 PHP sftp 进行文件打开是否有任何真正的区别,如下所示,使用ssh2_scp_send我计划在每个 php 会话上传多个文件,并且不想花太多时间上传文件。 If anyone is aware on how these to functions are implemented in PHP it would be great to know so i can choose the right one.如果有人知道这些 to 函数是如何在 PHP 中实现的,那么我会很高兴知道这样我就可以选择正确的函数。

Thanks Again.再次感谢。

The SFTP and the SCP are different protocols. SFTP 和 SCP 是不同的协议。 Both run over the SSH though.不过,两者都通过 SSH 运行。

The SCP can only copy (upload/download) files. SCP 只能复制(上传/下载)文件。 It cannot do any other operation like listing directory contents, deleting files etc.它不能执行任何其他操作,例如列出目录内容、删除文件等。

The SFTP is a full-fledged remote fie system protocol. SFTP 是成熟的远程文件系统协议。

The SCP might be quicker in general, as it is better able to utilize the SSH virtual connection channel. SCP 通常可能更快,因为它能够更好地利用 SSH 虚拟连接通道。 But it's worth testing both.但值得对两者进行测试。

Also note that the SCP will generally work against *nix SSH servers only.另请注意,SCP 通常仅适用于 *nix SSH 服务器。 The SFTP is more universal. SFTP 更通用。

For details on The SFTP + SCP refer to:有关 SFTP + SCP 的详细信息,请参阅:
https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol
https://en.wikipedia.org/wiki/Secure_copy_protocol https://en.wikipedia.org/wiki/Secure_copy_protocol

ssh2_sftp() is used on a existing connection, then you use fopen() however, this is also considered 'insecure' by most. ssh2_sftp()用于现有连接,然后您使用fopen()但是,这也被大多数人认为是“不安全的”。 Which is where ssh2_scp_recv() uses the Secure Copy based on BSD RCP Protocol.这就是ssh2_scp_recv()使用基于 BSD RCP 协议的安全复制的地方。 SCP uses Secure Shell (SSH) for data transfer and uses the same mechanisms for authentication, thereby ensuring the authenticity and confidentiality of the data in transit. SCP 使用 Secure Shell (SSH) 进行数据传输,并使用相同的身份验证机制,从而确保传输中数据的真实性和机密性。 A client can send (upload) files to a server, optionally including their basic attributes (permissions, timestamps).客户端可以向服务器发送(上传)文件,可以选择包括它们的基本属性(权限、时间戳)。 Clients can also request files or directories from a server (download).客户端还可以从服务器请求文件或目录(下载)。 SCP runs over TCP port 22 by default.默认情况下,SCP 在 TCP 端口 22 上运行。 Like RCP, there is no RFC that defines the specifics of the protocol.与 RCP 一样,没有定义协议细节的 RFC。

http://www.php.net/manual/en/function.ssh2-scp-recv.php http://www.php.net/manual/en/function.ssh2-scp-recv.php

http://en.wikipedia.org/wiki/Secure_copy http://en.wikipedia.org/wiki/Secure_copy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM