1

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 !

Ahmed
  • 169
  • 1
  • 4
  • 13
  • 1
    You did not change memory_limit if in error is **134217728** – venca Jun 09 '15 at 15:35
  • 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 Jun 09 '15 at 15:37
  • 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 Jun 09 '15 at 15:47
  • yes i forgot to restart Apache, i will try to work with caching methods thanks ! – Ahmed Jun 09 '15 at 15:49

2 Answers2

1

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

Rob G
  • 592
  • 4
  • 18
  • yes i forgot to restart my Apache but now i have a problem in execution time Fatal error: Maximum execution time of 120 seconds exceeded – Ahmed Jun 09 '15 at 15:46
  • You can try changing max_execution_time in php.ini or set it via PHP using set_time_limit(). – Adrien Jun 10 '15 at 03:24
0

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.

Heitor
  • 683
  • 2
  • 12
  • 26