有没有理由PHP ssh2_scp_send()函数不能在同一台机器上运行?

I am trying to connect via ssh from php, and send a file. When the machines are different, it works. When I connect to the same machine, it doesn't work.

$this->conn = ssh2_connect($this->ci['host'],$this->ci['ssh_port']);
ssh2_scp_send($this->conn,$ssh_source,$ssh_destination);

The connection $this->conn is valid in both cases. So is there any reasons why ssh2_scp_send() will not work when $this->conn connects to the same machine? When trying on the same machine I get: Warning: ssh2_scp_send(): Failure creating remote file: (null)

php

1个回答



根据这个 </ p>

1 http://php.net/manual/ en / function.ssh2-scp-send.php 文档此函数用于使用SCP协议将文件从本地文件系统复制到远程服务器。</ p>

所以 您可以使用此功能的同一系统 - 复制 </ p>
< / DIV>

展开原文

原文

As per this

1: http://php.net/manual/en/function.ssh2-scp-send.php Documentation this function is use for Copy a file from the local filesystem to the remote server using the SCP protocol.

So for same system you can use this function - copy

douwen3965
douwen3965 是的我知道,这只是我不想修改代码并添加一堆IF。 我期待的是 - 如果ssh2_connect()正在使用同一台机器 - ssh2_scp_send()也可以工作......文档并没有说这方面有任何限制。
大约 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐