PHPExcel Memory usage

Topics: User Forum
Jul 14, 2012 at 8:05 PM

Hi,

i´m trying to open a small Excel 2003 file (just 16.896 bytes), but i´m getting the following error:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 94 bytes) in /home/storage/1/59/45/elementos/public_html/protected/extensions/PHPExcel/Worksheet.php on line 1121

my code:

$inputFileType = 'Excel5';
    $inputFileName = '/home/storage/1/59/45/elementos/public_html/protected/data/planilha.xls';
    $sheetname = 'Plan1';
    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    $objReader->setLoadSheetsOnly($sheetname);
    $objPHPExcel = $objReader->load($inputFileName);

 

what am I doing wrong?

Coordinator
Jul 15, 2012 at 10:00 AM

If your file is just 16k in size, then there's almost no data in it; so you shouldn't be getting memory errors running with 64MB assigned to PHP. PHPExcel is memory hungry, but not generally that extreme.

You could try using cell cacheing, or try posting the file in our upload thread on the Issue Tracker to see if I can identify what might be eating all the memory.

Jul 15, 2012 at 10:55 AM

It was my fault, I forget to change FTP to binary mode before sending the file to server.

It is working now, thanks.