有没有理由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)

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