PHP ZipArchive在关闭时失败,没有错误消息

时间:2015-08-05 17:43:06

标签: php zip ziparchive

我已经实现了一个PHP脚本,它定期将一些图像添加到现有的zip存档中。但是,当zip存档超过131Mb时,它总是崩溃。我增加了memory_limit,max_input_time和执行时间,没有帮助。这个问题似乎真的是存档的大小。有人对此有解决方案/解释吗?

$valid_files = array('/path/to/file/a.png'); //Array of existing files
$zip = new ZipArchive();
if ( $zip->open( $destination, ZIPARCHIVE::CREATE ) !== true) {
        return false;
}
foreach ( $valid_files as $i => $file ) {
    $zip->addFile( $file, basename( $file ) );
}

if ( $zip->close() !== true ) {//close crashes the process if zip > 131Mb
    //PHP process is killed before reaching this
}

0 个答案:

没有答案
相关问题