So I use phpseclib which downloads a 50MB file over sftp in roughly 45 seconds. Which is fast compared to ssh2_scp_recv() which takes 90+ seconds, but slow compared to my sftp client (filezilla), which takes 10 seconds max.
My question is, what can I do to speed up file downloads through sftp, other than enabling the mcrypt, gmp and bcmath extensions which I've done already?
I'm running PHP 5.5 on Windows 7, and got the same results when using either cli or browser/apache, and using sftp->get to download a file as a whole, or download a file in chunks of various sizes.
Source:
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
require 'phpseclib/Net/SFTP.php';
$sftp = new Net_SFTP($host, $port, $timeout);
$sftp->login($user, $password);
$sftp->get($remoteFile, $localFile);