Reputation: 43
I am getting below error while reading large .xls file say 29MB (3 sheets, 28000 rows/sheet) using Spreadsheet_Excel_Reader.
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in...
I changed memory_limit in php.ini to 128M, and also tried change it run time as ini_set('memory_limit', '-1'); for unlimited but error not solved.
Upvotes: 1
Views: 1792
Reputation: 1135
Probably one server has a 64 bit processor. The GetInt4d bit shift doesn't work with 64 bit processors.
Use this hack to ensure correct result of the <<24 block on 32 and 64bit systems, just replace the code of the GetInt4d function with the following: Location : Excel/olereader.inc line no-27 ,function GetInt4d()
$_or_24 = ord($data[$pos+3]);
if ($_or_24>=128)
$_ord_24 = -abs((256-$_or_24) << 24);
else
$_ord_24 = ($_or_24&127) << 24;
return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24;
Upvotes: 0
Reputation: 810
ini_set('memory_limit', '-1');
overrides the default PHP memory limit
AND/OR
ini_set('max_execution_time', INCREASE TIME);
Upvotes: 0
Reputation: 11942
Not sure you could do '-1'.
You could try :
ini_set('memory_limit', '512M');
Upvotes: 0