note 97123 modified in function.ssh2-scp-send by danbrown
| From: | danbrown@php.net | Date: | Fri, 02 Apr 2010 14:41:54 +0000 |
| Subject: | note 97123 modified in function.ssh2-scp-send by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167648@lists.php.net to get a copy of this message | ||
On Windows, I had trouble using ssh2_scp_send: files copied to a remote server where incomplete
(truncated) and/or locked (error message : "access denied"). The back-end is also on
Windows, using CopSSH (cygwin-based SSH server).
The SSH session was kept open - and the file were never flushed to disk.
There's a workaround though - make an explicit call to "exit" to close the session
(flushing file content to disk):
<?php
$objConnection = ssh2_connect($strHost, $strPort, $methods, $callbacks);
ssh2_auth_password($objConnection, $strUser, $strPassword);
ssh2_scp_send($objConnection , $strSource, $strDest);
// Add this to flush buffers/close session
ssh2_exec($objConnection, 'exit');
?>
--was--
On Windows, I had trouble using ssh2_scp_send: files copied to a remote server where incomplete
(truncated) and/or locked (error message : "access denied"). The back-end is also on
Windows, using CopSSH (cygwin-based SSH server).
The SSH session was kept open - and the file were never flushed to disk.
There's a workaround though - make an explicit call to "exit" to close the session
(flushing file content to disk):
$objConnection = ssh2_connect($strHost, $strPort, $methods, $callbacks);
ssh2_auth_password($objConnection, $strUser, $strPassword);
ssh2_scp_send($objConnection , $strSource, $strDest);
// Add this to flush buffers/close session
ssh2_exec($objConnection, 'exit');
http://php.net/manual/en/function.ssh2-scp-send.php