Re: Hoping for a working example of SFTP in PHP
| From: | R. Eric Wheeler | Date: | Tue, 02 Feb 2021 19:33:03 +0000 |
| Subject: | Re: Hoping for a working example of SFTP in PHP | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327452@lists.php.net to get a copy of this message | ||
David,
I have written a working and tested example using Win 10 Pro, and PHP v7.4.14 with pecl-ssh2 v1.2.
https://gist.github.com/sikofitt/3c6818648874ce091006ff58f8f489c4
There are 2 examples of copying via ssh2.sftp:// stream and the ssh2_scp_send function. Also a directory iterator example.
https://www.php.net/manual/en/wrappers.ssh2
https://www.php.net/manual/en/function.ssh2-scp-send
It sounds like you have found the private and public keys and had them working using ssh from the command line. You can also pass the '-v' switch to the ssh program and it will tell you exactly what it is doing to connect.
Hope this helps!
Eric