Re: Hoping for a working example of SFTP in PHP
| From: | David Spector | Date: | Wed, 03 Feb 2021 16:14:45 +0000 |
| Subject: | Re: Hoping for a working example of SFTP in PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327455@lists.php.net to get a copy of this message | ||
Dear R. Eric Wheeler,
I just can't get the first approach to work (ssh2_connect, ssh2_auth_pubkey_file, ssh2_sftp, copy,
using either of these exact wrappers (6 is the ssh2_stfp resource):
ssh2.sftp://6/test.txt
or
ssh2.sftp://6/public_html/test.txt
With the test.txt file existing in both the document root and public_html directories on the remote computer, the file_exists function keeps returning false even though I added a call to clearstatcache. My PHP.ini file has wrappers enabled and the SSH2 extension is installed.
And the copy function is even worse: it times out in the browser.
The second approach works successfully (ssh2_connect, ssh2_scp_send).
If you can't help me with with the first approach, I'll drop it. But I would like to offer my readers both alternatives.
David