0
votes

PHP 5.3+'s native ZipArchive class (http://php.net/ziparchive) creates corrupt result files (.zip), but only when the result .zip is larger than ~4GB (i think 3,6 GB. Server is Ubuntu 10.10 64bit, 4GB RAM, latest PHP 5.3). The error (when unzipping this .zip, with whatever software you use) is:

file #1:  bad zipfile offset (lseek): 

According to several posting on the web this is simply the (undocumented) max limit for this class / the zip function. My question is: How to fix this, quick and dirty ? Are there some possible php.ini or server settings ? Or some other ways to create 4GB+ .zip files on native ubuntu systems ? I don't have root access and cannot install new packages.

There are some similar Q&As on this on Java: Zip files with Java: Is there a limit?

2
The only possibility I see is splitting them in 2 (or more...). - Sherlock
The limitation comes from the zip archive format itself. You can use another format, or split the file into pieces, like Robin suggested. - KingCrunch
~4GB? Smells of 32-bit integer overflow to me... - DaveRandom

2 Answers

2
votes

Wikipedia's quote :

The original zip format had a 4 GiB limit on various things (uncompressed size of a file, compressed size of a file and total size of the archive), as well as a limit of 65535 entries in a zip archive.

This is not a limitation of the class, but zip itself. You could switch to tar.gz for instance.

0
votes

I believe this is an issue with the file system used by the operating system. I would look at storing the data in multiple archive files.