php ssh2_scp_recv和ssh2_scp_send总是返回错误windows sftp服务器?

时间:2016-08-17 06:24:43

标签: php windows ssh sftp file-transfer

ssh2_scp_recvssh2_scp_send始终返回以下错误:

Severity: Warning
Message: ssh2_scp_send(): Failure creating remote file: Unexpected channel close

Severity: Warning
Message: ssh2_scp_recv(): Unable to receive remote file

当我连接到我的Windows sftp文件服务器OpenSSH for windows 7.3p1-1时 客户端也是一个Windows php iis环境与php ssh2 0.12 x64 for windows

$connection = ssh2_connect("myserver.com", 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);


$sftp_send = ssh2_scp_send($connection, "$_upload_path"."myfile", "$_remote_folder_path/myfile", 0644 );


$handle = opendir("ssh2.sftp://{$sftp}{$_remote_folder_path}");
 while (false != ($entry = readdir($handle))){

  if ($entry == "." || $entry == "..")
      continue;  
   echo $entry;

 $sftp_recv = ssh2_scp_recv ($connection,  $_remote_folder_path."/".$entry , $_download_path.$entry );
}

0 个答案:

没有答案