PHP compression options
I need to compress some binaries as fast as possible with PHP - it should be fast enough and easy to use. What options can you suggest to your fantastic people? :)
Jamie
I have no personal experience with them, but there is a whole section in the docs on Compression and Archiving Extensions
It looks like there are extensions for
- Bzip2
- LZF
- Phar
- Rar
- Zip
- Zlib
If you're working directly with files on the server, the ZipArchive class (which comes with the Zip extension) looks like this: it might be the easiest to use.
If clients will download them, you can configure Apache to compress them as they are served.
If this is where you are going to store them on the server, you can PHPZip them.
If an extension is available on your server, or if you can add it, LZF is what you are looking for. Otherwise gzcompress () with a compression ratio of 3 or less will be pretty fast.