Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Excel - Error Allowed memory size

I use Maatwebsite to load excel files. I'm loading fine several documents, until it gives the next error:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /project1/vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell.php on line 582

I'm went to config/excel.php and update memoryCacheSize setting to 128MB. After do that I run php artisan cache:clear and php artisan config:cache. Try load again and returns me the same error.

How can I solve that?

like image 334
user3242861 Avatar asked Apr 05 '18 14:04

user3242861


2 Answers

I would recommend using box/spout for larger files. I have used both and typically use Maatwebsite for smaller files because of the flexibility of file types.

https://github.com/box/spout

like image 170
adam Avatar answered Nov 09 '22 22:11

adam


Add this in your index.php file.

ini_set('memory_limit', '-1');
like image 26
Giri Annamalai M Avatar answered Nov 10 '22 00:11

Giri Annamalai M