PharData Error: Seek Failed, on Large Files
Posted: Wed Jul 29, 2015 10:02 am
I'm compressing very large files (between 25MB on the low end, 20GB on the high end). Using PharData to create a .tar.gz. The compression works for smaller files (totalling roughly 2GB or less), but bums out on larger files. It throws the following PharException:
Where DOM_9483.MOV is 4.62GB, a fairly typical size for what I need to compress.
Running on Windows Server 2012 R2 local SAN.
Thoughts?
Code: Select all
exception 'PharException' with message 'tar-based phar "C:/Apache24/htdocs/_frames/storage/glacier/archive_cache/339.tar" cannot be created, contents of file "DOM_9483.MOV" could not be written, seek failed' in C:/Apache24/htdocs/_frames/storage/glacier/cron/upload_archives.php:250 Stack trace: #0 C:/Apache24/htdocs/_frames/storage/glacier/cron/upload_archives.php(250): PharData->buildFromDirectory('C:/Apache24/htd...') #1 {main}Code: Select all
set_time_limit(0);
ini_set('memory_limit','2048M');
//...
$archive_filename_tar = GLACIER_CACHE.$archive['id'].'.tar';
$archive_filename = GLACIER_CACHE.$archive['id'].'.tar.gz';
$tmp_location = GLACIER_CACHE.$archive['id'].'.tmp';
$src_location = rtrim($archive['folder'],'/');
//wait, exceptions; throws ErrorException
set_error_handler('exception_error');
try {
// Copy directory to temporary location to divorce it from file sharing
rcopy($src_location,$tmp_location);
// Create archive
$archive_class = new PharData($archive_filename_tar);
$archive_class->buildFromDirectory($tmp_location);
$archive_class->compress(Phar::GZ);
}
catch (ErrorException $e) {
_log(1,'Uploading Archives [Copy/Compression Error #1]',(string)$e);
continue;
}
catch (Exception $e) {
_log(1,'Uploading Archives [Copy/Compression Error #2]',(string)$e);
continue;
}
finally {
// Clean Up Memory
unset($archive_class);
}Thoughts?