Php_zip.dll

software development

#1

i like php_zip (instead of zlib & co) because of the function “addFromString”, which allows me to avoid to write some temporary files on disk to zip them.

it appears that maybe the extension is not enabled on DH, because: $zip = new ZipArchive();
returns to a blank page :open_mouth:

any idea? thanks


#2

zlib-1.2.3 and compile PHP with --enable-zip :wink:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#3

thanks :slight_smile:
DH wrote me I have to use zlib… now I have to discover if zlib has some sorta of “addFromString” function… :frowning: i doubt…


#4

Yeah, it does. You can use it like this:

$zip = new ZipArchive; $zip->open('archive.zip', ZipArchive::CREATE); $zip->addFromString('test.txt', 'A string or var to put in test.txt here'); $zip->close();

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#5

I am sorry, but I think that your code works only if “php_zip” extension is enabled. On DH it is not enabled.


#6

Note my first response :wink:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#7

Take a look at gzcompress and gzencode.

Just so you know, zlib will not create a .zip file, it will create a .gz (gzip) file.


#8

[quote]Take a look at gzcompress and gzencode.

Just so you know, zlib will not create a .zip file, it will create a .gz (gzip) file.[/quote]
Just so you know, zlib is a library and doesn’t “create .gz files”. Gzip does that :wink:

The ZIP format permits many cmpalg’s, of which only DEFLATE is widely used and supported.

zlib = DEFLATE (check it out).

Compiling PHP with [color=#00CC00]–enable-zip[/color] = access [color=#0000CC]addFromString()[/color], which is OP’s primary goal.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost