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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.