-1

I am using PHPExcel library to read and write excel file excel2007 format. These are not big excel files, approximately 120rows and 20columns only.. When I run on my dedicated server its showing error as follows..

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 40 bytes) in /home/ramdas/public_html/partnumber/inc/PHPExcel/Style/Supervisor.php on line 126

And here is my code.. i am using memory cacheing techniques..

    include("inc/PHPExcel.php");
    $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
    $cacheSettings = array( 'memoryCacheSize' => '512MB');
    PHPExcel_Settings::setCacheStorageMethod($cacheMethod,$cacheSettings);
    $objPHPExcel = new PHPExcel();

I have checked the return value of PHPExcel_Settings.. its return true..

Please help me to solve this issue... I have tried all the answers available here... Nothing help me to solve..

1 Answers1

2
$cacheSettings = array( 'memoryCacheSize' => '512MB');

This is telling PHP to use memory up to 512MB before it will even start caching cell data to php://temp

You don't have 512MB of memory, you only have 32MB (33554432 bytes)

PHPExcel doesn't automagically create memory out of the aether, it's restricted by the physical memory that's available.

You need to use a smaller value for memoryCacheSize than your available memory, perhaps 8MB, perhaps even less

$cacheSettings = array( 'memoryCacheSize' => '8MB');
Mark Baker
  • 199,760
  • 28
  • 325
  • 373