我想在Windows Server上压缩50K文件的大文件夹。我目前使用这个代码:使用PHP在Windows Server上压缩大目录
include_once("CreateZipFile.inc.php");
$createZipFile=new CreateZipFile;
$directoryToZip="repository";
$outputDir=".";
$zipName="CreateZipFileWithPHP.zip";
define("ZIP_DIR",1); //
if(ZIP_DIR)
{
//Code toZip a directory and all its files/subdirectories
$createZipFile->zipDirectory($directoryToZip,$outputDir);
}else
{
//?
}
$fd=fopen($zipName, "wb");
$out=fwrite($fd,$createZipFile->getZippedfile());
fclose($fd);
$createZipFile->forceDownload($zipName);
@unlink($zipName);
一切工作正常,直到2K左右的图像文件。但这不是我想要得到的。我愿意至少处理像50K图像的压缩文件。同时我的剧本得到这个错误:
Fatal error: Maximum execution time of 360 seconds exceeded in C:\xampp\htdocs\filemanager\CreateZipFile.inc.php on line 92
$newOffset = strlen(implode("", $this->compressedData));
我在寻找的任何解决方案进行文件的如此巨大的数额。我目前在Windows Server 2008 Standard上使用XAMPP。是否有可能使小部分的拉链,使用系统命令,也许外部工具来打包它们,然后将其发送到标题下载?
http://pastebin.com/iHfT6x69为CreateZipFile.inc.php
考虑使用像Gearman这样的设置工作服务器。 – halfer
听起来很不错,但是设置起来对我来说可能很难:( – user2945583
)为什么?让自己成为一个VPS,它可以用一些命令来安装,如果你不知道怎么做,那么你可以学习;这是值得学习的技术 – halfer