tags:

views:

18

answers:

1

Welcome,

Does someone have any resources about creating large zip files (one file, not folder) in PHP ?

  • Without using shell access to "zip" application.
  • low memory usage (i can't use gzcompress) because file is to large to do this in RAM.

I have unzip function work perfect on low memory system

Here is unzip,.

http://paste-it.net/public/wdb61dc/

Regards

A: 

If the deflate algorithm is too memory intensive for you then there isn't really a good way to do what you want. You can try turning down the compression.

Can you give us an idea of how large the file is and how much memory you want to work with?

OmnipotentEntity
For example i would like compress a 150 MB file using 32MB/64MB of RAM.
marc
Aside from turning down the compression, the only thing I can suggest is perhaps chopping the file up to several segments and then using tar to bind them together once finished. That's not near enough memory for compression of a 150MB file. That will not work if you need a single gzipped file (such as to serve to a webbrowser.)
OmnipotentEntity
Actually, i have upload that file to a ftp server (it will contain backup). Can't i (read 10 kb from file -> compress -> put into end of zip file) and do this in foreach until end of file ?
marc
It won't be a proper "zip" file if you do it that way, and you'll have to decompress it the same way, that's roughly equivalent to what I suggested with chopping the file up. It also won't compress worth a crap, but you have to give that up in order to compress with that little memory.
OmnipotentEntity