Re: Hoping for a working example of SFTP in PHP
| From: | R. Eric Wheeler | Date: | Sun, 07 Feb 2021 04:22:28 +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-327468@lists.php.net to get a copy of this message | ||
David,
Yes. This fixed the timeout happening for me. Using WAMP and cmd.exe on windows and apache 2.4 on linux.
You can also try using set_time_limit at the top of the script with a high value.
You might need to debug the ssh connection on the server at this point and see exactly what it is it doing.
You can set the option LogLevel to DEBUG in /etc/ssh/sshd_config and restart. Then run 'tail -f /var/log/auth.log' in the console.
Although both file_exists and copy work on streams, you can also try using fopen and fwrite instead like the example links Jose sent to the list.
Eric
On 2/6/21 6:09 PM, David Spector wrote:
Eric, Thank you for all your work. Shows how uninterested the world is in having good secure file copying in PHP. But after I changed the end of the program to ssh2_disconnect($sftp); ssh2_disconnect($connection); the same error happens (a browser timeout). Are you sure these two statements are correct? David