php - Allowed memory size Laravel (unzipping file with Laravel) -
i'm trying unzip big file unzip big dump file , run common problem:
local.error: symfony\component\debug\exception\fatalerrorexception: allowed memory size of 134217728 bytes exhausted (tried allocate 123732000 bytes) in /users/ ...
i know can increase memory limit , should work, think problem in code , i'm doing wrong:
public function unzip() { // unzip file // set input , output files $out = 'storage/app/dump/auct_lots_full.sql'; $in = 'storage/app/dump/auct_lots_full.sql.bz2'; // decompress file using bzip2 if (file_exists($in)) { $data = ''; $bz = bzopen($in, 'r') or die('error: cannot open input file!'); while (!feof($bz)) { $data .= bzread($bz, 4096) or die('error: cannot read input file');; } bzclose($bz); file_put_contents($out, $data) or die('error: cannot write output file!'); echo 'decompression complete.'; }
Comments
Post a Comment