Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Unzip very large file

I have a zip file on the server. It's 1.1gb made up of thousands of small files. I do not have shell or root access to the server and can only use ftp and create php files.. so far I have tried exec and shell exec but none worked. The server is running free bsd. How can I unzip the file into the directory it is in?

like image 337
Ozzy Avatar asked Jun 01 '13 22:06

Ozzy


2 Answers

For a pure PHP solution, try PclZip - this would not require you to install any PHP extensions or require shell access - you just need to write access to wherever you want to extract the files.

like image 151
Paul Dixon Avatar answered Sep 24 '22 02:09

Paul Dixon


$filename = '/media/file.gz';

$unzipped_content = '';   
$zd = gzopen($filename, "r");
while ($zip_file = gzread($zd, 10000000)){
    $unzipped_content.= $zip_file;
}
gzclose($zd);

echo $unzipped_content;
like image 38
elad Avatar answered Sep 25 '22 02:09

elad