开发者

problem on zipping big files

Using this code to zip a folder and it works perfect on small 开发者_运维问答files like 18-20 mb but when it comes to files like 80-90 mb it just doesnt work,

i though it is related to php memory settings but not sure,

$zipfile = new zipfile();
$folder = "path/to/folder";
if (is_dir($folder)) {
 if($dir = opendir ($folder)) {
        while (false !== ($file = readdir($dir))) {
         if($file != ".") {
         if($file != "..") {
            $zipfile -> addFile(file_get_contents($folder."/".$file), $file);
            }
            }
        }

        closedir($dir);
$contents = $zipfile -> file();
file_put_contents($f, $contents);
}
}

any suggestion ?

thx


It sounds like a script timeout issue. The timeout limit is set by the max_execution_time variable in your php.ini file, but you can also alter the timeout value on a script by script basis. To set the script execution limit to 60 secs;

set_time_limit(60);

For more info, checkout php docs - http://php.net/manual/en/function.set-time-limit.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜