Page 1 of 1

How to fix Fatal Error PHPExcel: Memory Limit Exhausted whil

Posted: Tue Jun 18, 2013 11:57 am
by raorafique
I am facing this problem while reading an XLSX files having 40,000 plus rows and 7 columns having 5MB+ file size with PHPExcel.

The error description is given here:

Quote:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in .....
Can you please suggest me a solution to this problem?

Thanking you in anticipation.

Best Regards,
Rao Rafique.

Re: How to fix Fatal Error PHPExcel: Memory Limit Exhausted

Posted: Tue Jun 18, 2013 12:34 pm
by mecha_godzilla
Hi,

How many files are you importing (reading) into the script and how many files are you exporting (if any)? The problem might be that once you've read the first file, you need to release the memory that has been reserved for that operation - in this case, you should amend your script to import one file *only* and then use memory_get_usage() to work out exactly how much memory your script needs.

If the problem is that you are reading one file *only* and that on its own is occupying all the memory, you might need to add a PHP directive to the script to override the memory usage or script execution time values defined in your php.ini file.

HTH,

Mecha Godzilla

Re: How to fix Fatal Error PHPExcel: Memory Limit Exhausted

Posted: Tue Jun 18, 2013 3:53 pm
by pickle
I believe PHPExcel has a way to read in a file one row at a time, rather than loading the entire file into memory before reading.