|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2008-12-02 17:10 UTC] mike at regexia dot com
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 16:00:01 2025 UTC | 
Description: ------------ Target: Connecting with ssh2 to host, authenticate with pubkey, read Directory, copy every file to host and delete those files on remote server. Copy() gives the correct return value (bool(true)) if the file could be copied and i can check this value. Unlink() returns false, but the file on the server has been deleted. Using: - Debian Linux with 2.6.22-2-686 #1 SMP Kernel - OpenSSH_4.7p1 Debian-2, OpenSSL 0.9.8g 19 Oct 2007 - PHP 5.2.5-3 (cli) Reproduce code: --------------- $ssl_conn = ssh2_connect('hostname'); $ssl_auth = ssh2_auth_pubkey_file($ssl_conn, 'username', './.ssh/id_rsa.pub', './.ssh/id_rsa'); $sftp = ssh2_sftp($ssl_conn); $path = 'ssh2.sftp://' . $sftp . '/path/'; $dir = opendir($path); while (($entry = readdir($dir)) !== false) { print $path . "\n"; print $entry . "\n"; $copy = copy($path . $entry, 'path/' . $entry); var_dump($copy); print_r($copy); $unlink = unlink($path . $entry); var_dump($unlink); print_r($unlink); } Expected result: ---------------- ssh2.sftp://Resource id #5/path/ filename bool(true) 1 bool(true) 1 Actual result: -------------- ssh2.sftp://Resource id #5/path/ filename bool(true) 1 bool(false)