How to increase the performance of a file upload using native sftp functions and fwrite in PHP
问题 Hi I am using the following code to upload a huge file (500MB) to a sftp server. <?php $connection = ssh2_connect($this->host, $this->port, null); $sftp = ssh2_sftp($connection); $connection_string = ((int) $sftp) . $remotePath . $remoteFilename; $stream = fopen('ssh2.sftp://' . $connection_string, 'w'); $source = fopen($localFilepath, 'r'); if (!$stream) { throw new Exception('Could not create file: ' . $connection_string); } while (!feof($source)) { // Chunk size 32 MB if (fwrite($stream,