我使用 Spreadsheet_Excel_Reader 读取大型.xls文件说29MB(3张,28000行/张)时出现以下错误 .
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in...
我将php.ini中的memory_limit更改为128M,并尝试将其运行时更改为ini_set('memory_limit',' - 1');无限但错误未解决 .
不确定你能做'-1' .
你可以尝试:
ini_set('memory_limit', '512M');
ini_set('memory_limit', '-1'); 覆盖默认值PHP memory limit
ini_set('memory_limit', '-1');
AND / OR
ini_set('max_execution_time', INCREASE TIME);
可能一台服务器有一个64位处理器 . GetInt4d位移不适用于64位处理器 .
使用此hack确保32位和64位系统上的<< 24块的正确结果,只需用以下代码替换GetInt4d函数的代码:位置:Excel / olereader.inc第27行,函数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;
3 回答
不确定你能做'-1' .
你可以尝试:
ini_set('memory_limit', '-1');
覆盖默认值PHP memory limitAND / OR
可能一台服务器有一个64位处理器 . GetInt4d位移不适用于64位处理器 .
使用此hack确保32位和64位系统上的<< 24块的正确结果,只需用以下代码替换GetInt4d函数的代码:位置:Excel / olereader.inc第27行,函数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;