PHP Classes

Allowed memory size to allocate

Recommend this page to a friend!

      dUnzip2  >  All threads  >  Allowed memory size to allocate  >  (Un) Subscribe thread alerts  
Subject:Allowed memory size to allocate
Summary:Problem with unzip the file, becouse of memory limit to allocate
Messages:2
Author:Michal
Date:2009-12-28 13:17:47
Update:2011-12-12 16:25:59
 

  1. Allowed memory size to allocate   Reply   Report abuse  
Picture of Michal Michal - 2009-12-28 13:17:47
Hi,
On my server I need to uncompress file which is exported part of database from other server. Zipped file is 10mb, inside is only one file more than 500mb.
My code:
<code>
<?php
require_once dirname(__FILE__)."/classes/dUnzip2.inc.php";

$data = implode(file("http://www.xxx.pl/offer.php?cmd=trips_z&username=user&password=pass&format=gzip"));

if($fh = fopen('trip_brazil.zip', 'w+')){
fputs($fh, $data);
fclose($fh);
}

$zip = new dUnzip2('trip_brazil.zip');
$zip->unzipAll();

?>
</code>

The problem is memory limit to allocate.
Here is the error message:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 543881838 bytes) in /home/studiomi/public_html/eximoferta/classes/dUnzip2.inc.php on line 310

  2. Re: Allowed memory size to allocate   Reply   Report abuse  
Picture of Koroush Raoufi Koroush Raoufi - 2011-12-12 16:26:00 - In reply to message 1 from Michal
I found a way
if ini_set is not limited on your web server
you can use
this before run unzip class

ini_set('memory_limit','1024M');