How can I use non-blocking up/downloads with ssh2_sftp_
(like with ftp_nb_put
/ftp_nb_get
)?
Asked
Active
Viewed 169 times
-1

Martin Prikryl
- 188,800
- 56
- 490
- 992

root66
- 477
- 5
- 17
1 Answers
0
The PHP SSH2 functions do not support non-blocking operation. Neither phpseclib does.
But you can move your download code to a separate thread using the Thread
PECL class.
For an example see:
How can one use multi threading in PHP applications
Or you can upload the file in chunks.
See https://phpseclib.com/docs/sftp#positional-control

Martin Prikryl
- 188,800
- 56
- 490
- 992