1
votes

i try to treat a massive excel file (5500 row * 50 column) with PHP my code is correct i don't have any bug when i tried it for only 100 rows. but when i put the whole file, i have this fatal Error i tried to change the memory_limit to 256 instead of 128 but nothing happen is there any solution to process my hole file !

the error is : Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24 bytes) in C:\wamp\www\zannier\Classes\PHPExcel\CachedObjectStorage\CacheBase.php on line 173 and my code is :

 <?php

    require_once ".\Classes\PHPExcel\IOFactory.php";

    $objPHPExcel = PHPExcel_IOFactory::load("zfg01_CAT.xls");


    $sheet = $objPHPExcel->getSheet(0);

   include 'fonctionsUtiles.php';
  // afficherUneFeuille($sheet);
   echo'<br>';
   echo $sheet->getHighestRow();
   echo'<br>';

   supprimerLesDoublons($sheet);
   afficherUneFeuille($sheet);
    echo $sheet->getHighestRow();
   echo'<br>';

    ?>

Thanks !

2
You did not change memory_limit if in error is 134217728venca
you either didn't restart the webserver after changing the .ini file, or you changed the WRONG .ini file and never changed the limit at all.Marc B
If you're working with large Excel files with PHPExcel, then why aren't you using any of the documented caching methods to reduce the memory usage?Mark Baker
yes i forgot to restart Apache, i will try to work with caching methods thanks !Ahmed

2 Answers

1
votes

You need to bounce Apache for the changed setting to be picked up

0
votes

Do it with caution: set memory_limit = -1 in php.ini file. Restart Apache.

Important for WAMP: it uses two php.ini file, the one when you click throught WAMP tray menu (works for apache when you open the script in the browser) and the other one inside WAMP's directory tree (something like C:\wamp64\bin\php\php5.6.25\php.ini) who works when you execute PHP in the command line.