簡體   English   中英

php-excel-reader允許的內存大小為134217728字節已用盡

[英]php-excel-reader Allowed memory size of 134217728 bytes exhausted

require_once 'Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();

$data->read('Senator.xls');

我在error.log中收到以下錯誤

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes)

奇怪的是,這在我的開發實例上工作得很好。 但不在生產中。 我應該尋找什么差異。

注意:兩個環境都具有memory_limit = 128M

可能一台服務器具有64位處理器。 GetInt4d移位不適用於64位處理器。

使用此技巧可確保在32和64位系統上<< 24塊的正確結果,只需將GetInt4d函數的代碼替換為以下內容:Location: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;

取決於女巫行它給出了錯誤:我是

PHP Fatal error:  Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in [] on line 1688

這是功能

addcell($row, $col, $string, $info=null) {

特別是foreach循環。 據我了解,它是有關顏色單元偏移量或類似信息的信息,因此我評論了循環,現在它使用的內存要少得多。

如果不需要執行此類代碼,則可以對其進行注釋並嘗試。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM