|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-11-24 10:19 UTC] indeyets at gmail dot com
Description:
------------
When adding files to archive, the process stops at file 252 (actually depends on ulimit)
Reproduce code:
---------------
<?php
// THIS IS "test.php"
$file = realpath('./test.php');
$zip = new ZipArchive();
$zip->open('test.zip', ZIPARCHIVE::CREATE);
for ($i = 0; $i < 1000; $i++) {
$res = $zip->addFile($file, 'test'.$i.'.php');
if (false === $res)
die("oops @ ".$i."\n");
}
$zip->close();
unlink('test.zip');
echo 'done'."\n";
Expected result:
----------------
done
Actual result:
--------------
oops @ 252
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 14:00:01 2025 UTC |
Which OS? Windows has such limits by default, unices limits are higher and can be increased. However, there is no way to increase this limit. And there is no other safe way to keep files intact until the script close the archives. What I suggest is to close the archive and reopen it: if ($filescnt%255==0) {close/reopen} see #8714 for more details.