简体   繁体   中英

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?

对于纯PHP解决方案,请尝试PclZip - 这不需要您安装任何PHP扩展或需要shell访问 - 您只需要将访问权限写入您想要提取文件的任何位置。

$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;

Thanks for the suggestions everyone. I ended up modifying the code in this question to unzip the files.

Unzip a file with php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM