Boniface Pereira
Boniface Pereira

Reputation: 308

Non-blocking SFTP/FTPS uploads with PHP?

PHP has an function for uploading files non-blocking ftp_nb_put(), but i would like to know if non-blocking ftp uploads is possible with sftp & ftps.

If not, what other languages provide non-blocking ftp uploads for sftp/ftps ?

Thank you.

Upvotes: 2

Views: 440

Answers (2)

Martin Prikryl
Martin Prikryl

Reputation: 202272

It's not about the language, but having a library that supports non-blocking operations.


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 spawn an external process for the transfer.

Upvotes: 0

Non-blocking operations are not about languages, but about particular software components. You can have non-blocking transfer in any language given that you have the proper components. In .NET, Java, Delphi there are plenty of such components.

In PHP you can spawn an external process which will perform the upload under the hood.

Upvotes: 2

Related Questions