Compressing Files with PHP

Most users are familiar with client-based GUI compression utilities such as WinZip or StuffIt, which will compress and decompress files. Thanks to the zlib, available from www.gzip.org/zlib (Figure 8.6), you can have PHP automatically compress files as well. The zlib library was written by two of the major compression/decompression developers as a patent-free, lossless data-compression tool. Zlib is available on every major platform (even for Palm handhelds!) and is frequently built into a server's configuration. I would be surprised if a Unix-brand of operating system did not include zlib, and you can use a Dynamic Link Library (DLL) version of the library on Windows.

Figure 8.6. The zlib library adds compression capability ...

Get PHP Advanced for the World Wide Web: Visual QuickPro Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.