0

Currently I have a backend application that downloads one file per request. The file is not downloaded to end user in a web browser, and I'm trying to find ways of improving performance when downloading from an FTP server.

I connect to the FTP server in question using ftp_ssl_connect and when I get the file for download, I do so with ftp_fget with mode FTP_BINARY.

For files of 8 MB or less (they are zip archives, b.t.w) the performance is fine, but I now have files that range from 30 MB to 300 MB. I understand that "it takes time" to obtain files and the larger the file, the more time required... etc.

To increase performance (or maybe I'm trying to reduce strain on system) I'd like to perhaps do FTP download of large files in chunks. So far I haven't seen much in PHP FTP function examples for this. I read about non-blocking FTP file getter functions, but I'm not really trying to solve the problem of "forcing a user to wait for the file to finish" - hence I'm ok with the server doing what it needs to do to get that file.

Should I consider instead using Curl as given in this SO example? Using CURL/PHP to download from FTP in chunks to save memory - Stack Overflow

Alternately can anyone recommend an existing package from https://packagist.org ?

Thanks, Adam

Community
  • 1
  • 1
Adam T
  • 675
  • 8
  • 22
  • 1
    I would check out http://stackoverflow.com/questions/6409462/downloading-a-large-file-using-curl – MonkeyZeus Jun 17 '16 at 14:13
  • 1
    This could be useful as well http://stackoverflow.com/a/3938551/2191572 – MonkeyZeus Jun 17 '16 at 14:13
  • Thanks @MonkeyZeus I appreciate the links. They seem to be along the lines of what I'm looking for. Hopefully they will lead to better performance (decreased processing times) for the large files. – Adam T Jun 17 '16 at 16:33
  • You're welcome. If I had any experience with the goal you are trying to accomplish then I would have definitely provided an answer but I guess my Google-fu skills were enough in this case. Good luck with your project! – MonkeyZeus Jun 17 '16 at 19:09

0 Answers0