I have an error on upload files with aprox 130.000 rows (23MB). The code works good with small files but when I try to upload bigger ones this error always comes out. I have already tried the cell caching method to reduce memory usage but the error remains. In my php.ini the parameters are memory_limit=128M / upload_max_filesize=64M / post_max_size=64M.
Warning: simplexml_load_string(): Memory allocation failed in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): Entity: line 2: parser error : Memory allocation failed : xmlSAX2Characters in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): "><c r="I935190" s="9"/></row><row r="935191" spans="9:9" x14ac:dyDescent="0.25" in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): ^ in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): Memory allocation failed : building attribute in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): Memory allocation failed : building attribute in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): Memory allocation failed in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): Entity: line 2: parser error : Extra content at the end of the document in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): "><c r="I935190" s="9"/></row><row r="935191" spans="9:9" x14ac:dyDescent="0.25" in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
And when I try the uploading again it appear:
Warning: simplexml_load_string(): Memory allocation failed : growing buffer in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
Warning: simplexml_load_string(): Memory allocation failed : growing buffer in C:\xampp\htdocs\lib\PHPExcel\Reader\Excel2007.php on line 652
A piece of the php code, all warnigs appear on the 9th line when I load the file:
$total = count($_FILES["file"]["name"]);
for($j=0; $j<$total; $j++){
$tmpFilePath =$_FILES["file"]["tmp_name"][$j];
if ($tmpFilePath != ""){
$newFilePath = 'ficheros/'. $_FILES["file"]["name"][$j];
}
if(move_uploaded_file($tmpFilePath, $newFilePath)){
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($newFilePath);
$sheetCount = $objPHPExcel ->getSheetCount();
$sheetNames = $objPHPExcel -> getSheetNames();
$objWorksheet = $objPHPExcel -> getSheetByName("Sheet1");
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
$rows = array();
for ($row = 2; $row <= $highestRow; ++$row) {
for ($col = 0; $col <= $highestColumnIndex; ++$col) {
$rows[$col] = $objWorksheet->getCellByColumnAndRow($col, $row)->getCalculatedValue();
}
mysql_query..
}
}
Thanks in advance