phpftpsftpftps

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.


Solution

  • 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.