Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I use this coding to read the excel file obviously this coding work but this coding wasn't work when i put this file on Xeon server....I cant able to identify the problem

I got the following error message:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /home/ch2dev/public_html/application/views/oleread.inc on line 27

Please help me to solve this problem

include('include.php');
require_once 'reader.php';

echo "
";

$fileName="new1.xls";
$prod=parseExcel($fileName);
print_r($prod);




function parseExcel($excel_file_name_with_path)
{
$data = new Spreadsheet_Excel_Reader();
// Set output Encoding.
$data->setOutputEncoding('CP1251');
$excel_file_name_with_path;

$data->read($excel_file_name_with_path);



$colname=array();


for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {

$product[$i-1][$j-1]=$data->sheets[0]['cells'][$i][$j];
$product[$i-1][$colname[$j-1]]=$data->sheets[0]['cells'][$i][$j];
}
}
return $product;
}

?>
Posted
Comments
Hatepeora 19-Feb-16 9:04am    
Here is an approach for reading excel files from PHP that actually is not affected by memory limit for PHP framework.

1 solution

Your php config has a value of 128M for memory_limit, and you're hitting that limit reading the Excel file. You can either increase that value in your php config file (php.ini) or try increasing it at the beginning of your script with ini_set().
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900