PHP CURL corrupting GZIP file during server-to-server transfer
One of the open source apps I manage (phpMySQLAutoBackup) uses PHP gzencode to compress the exported SQL data. It has the option to transfer the compressed file via PHP CURL to a remote server, but the remote copy of the gzencoded file gets corrupted.
Expanding the gz file saved LOCALLY is NOT corrupted. However, when checking the remote copy it has been corrupted after/during transfer. Tried PHP CURL, and PHP ftp_fput both corrupt the file, but ONLY when the data is 开发者_如何学编程encoded! Leave OUT the PHP gzencode (so transferring plain text) and the data is transferred without error.
So how do I preserve the data during transfer from server-to-server of the gzencoded data?
BTW: also already tried BINARY mode in both PHP CURL, and PHP ftp_fput.
What exactly is "corrupted"? The .gz won't decompress at all? A few bytes in the middle are different? File's longer? shorter?
Have you looked at the resulting corrupted file in a text/hex editor? Maybe there's some PHP warnings getting embedded in the data.
精彩评论