PHPExcelAllowedmemorysizeof memory leakage solution. This article introduces a solution for PHPExcelAllowedmemorysizeof memory leakage. if you have such problems, refer. I am using PHPExcel to import about 31 columns one by one. This article introduces a solution for memory leakage in PHPExcel Allowed memory size. if you encounter such problems, refer.
After I use PHPExcel to import a document containing about 31 columns and 500 rows, PHP reports the following error:
Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 35 bytes)
Authorization: wwwClassesPHPExcelCell. php on line 711
SolutionIs to add the method in the PHPExcel_Worksheet class:
The code is as follows: |
|
Public function Destroy (){ Foreach ($ this-> _ cellCollection as $ index => $ dummy ){ $ This-> _ cellCollection [$ index] = null; } } Add the following methods to the PHPExcel class: Public function Destroy (){ Foreach ($ this-> _ workSheetCollection as $ index => $ dummy ){ $ This-> _ workSheetCollection [$ index]-> Destroy (); $ This-> _ workSheetCollection [$ index] = null; } } |
Another way is to modify your php memory configuration and add
Add a statement to the PHP file
The code is as follows: |
|
Ini_set ('memory _ limit ','-1 '); Or Ini_set ('memory _ limit ', '265m ') |
Modify php. ini)
The code is as follows: |
|
Memory_limit = 12 M |
Add the following content to the. htaccess file:
The code is as follows: |
|
Php_value memory_limit 12 M |
Memory Allowed memory size of memory leakage solution. if you encounter such problems, refer. I'm using PHPExcel to import about 31 columns one by one ,...