Re: Hoping for a working example of SFTP in PHP
| From: | R. Eric Wheeler | Date: | Mon, 08 Feb 2021 15:38:48 +0000 |
| Subject: | Re: Hoping for a working example of SFTP in PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327474@lists.php.net to get a copy of this message | ||
David,
After looking at the previous emails and this error message -
"Warning: copy(ssh2.sftp//6/home/nsr/public_html/test.txt): failed to open stream: No such file or directory in C:\Dropbox\Private\Web\nsr-HMAC\upload\Wheeler-2.php on line 67
Failed to copy local file 'C:\Dropbox\Private\Web\nsr-HMAC\upload\test.txt' to remote file 'ssh2.sftp//6/home/nsr/public_html/test.txt' "
I noticed that the sftp stream url is missing the colon.
You have ssh2.sftp//6/home/nsr/public_html/test.txt,
but it should be
ssh2.sftp://6/home/nsr/public_html/test.txt
I think this is the problem.
Eric
On 2/7/21 2:16 PM, David Spector wrote:
They look correct to me: local file C:\Dropbox\Private\Web\nsr-HMAC\upload\test.txtremote /home/nsr/public_html/test.txt I've been debugging by printing out values all throughout the past few weeks of working on these examples. The only frustration is that our network environment is like black boxes. We don't have the feedback from SFTP and security processes to know exactly what's going on behind the simple "copy" function. All we know is that it doesn't work. The experts, who know all this stuff inside-out, don't care to share their knowledge, so far as I can tell. There's probably just one little twist of knowledge omitted that is keeping us from success. I guess at some point I have to give up on "copy" and just use the ssh2_scp_send function. A big failure for PHP documentation and error messages, which should both help a programmer achieve success. I did much better than this in my own systems and tools programming during my 40 year career as a software engineer. Thanks, Eric, for all your help. David