Éber Freitas Dias
|Unzipping files in PHP with zlib?||#1|
My web site is hosted at Dreamhost and there they only get zlib installed along with PHP. I couldn't figure out how to unzip files with the commom methods from this extension as described here : http://php.net/zlib
Does anyone knows how can I unzip a .gz or .gzip file with zlib extension on PHP? That would save my life!
posted date: 2008-12-21 11:49:00
|Re: Unzipping files in PHP with zlib?||#3|
The manual gives a pretty good example.
posted date: 2008-12-21 11:53:00
|Re: Unzipping files in PHP with zlib?||#4|
GZip and Deflate are explained in RFC 1952 (GZip) and RFC 1950 (Deflate). GZip is just Deflate with a header described there, so you can parse that header to detect where the zLib stream is and decompress it with zLib routines.
posted date: 2008-12-21 11:54:00
|Re: Unzipping files in PHP with zlib?||#5|
As written in zlib's PHP binding introduction:Version 4.0.4 introduced a fopen-wrapper for .gz-files, so that you can use a special zlib: URL to access compressed files transparently using the normal f*() file access functions if you prefix the filename or path with zlib: when calling fopen(). [...] In PHP 4.3.0, zlib: has been changed to compress.zlib:// to prevent ambiguities with filenames containing ':' characters.Simply
your file with
prepended, and use it as normal.
posted date: 2008-12-21 11:59:00
|select page: « 1 »|