0
votes

While uploading Excel File in Laravel, throws error Allowed memory size of 536870912 bytes exhausted (tried to allocate 33554432 bytes) in folderpath/vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php:1213

I'm using PHP 7.1. My php.ini file has set memory_limit to 2048M Even if I upload the small excel file same error

1
Sounds like an infinite loop. Maybe show your source code. Pointing to where you think the bug is is of no help since you don't know where it is.GetSet

1 Answers

1
votes

That specific row of PHPExcel relates to the instantiation of a cell instance, so I guess your excel file might have a lot cell's or due to a bug it end's in a loop, but thats hard to say without seeing it.

You may consider changing to the successor of the PHPExcel package called PhpSpreadsheet and see if it helps. It contains a lot of optimizations, although the structure is different. It also supports php7.1, so it could be an option for you, so why don't you give it a try?

PhpSpreadsheet is the next version of PHPExcel. It breaks compatibility to dramatically improve the code base quality (namespaces, PSR compliance, use of latest PHP language features, etc.). Because all efforts have shifted to PhpSpreadsheet, PHPExcel will no longer be maintained. All contributions for PHPExcel, patches and new features, should target PhpSpreadsheet master branch.

https://phpspreadsheet.readthedocs.io/en/latest/