【发布时间】:2013-01-18 07:08:43
【问题描述】:
我将文件 csv 的值读取为:
//$mypath . '/' . $filename <=> ../abc.csv
$val = file_get_contents($mypath . '/' . $filename);
$escaped = pg_escape_bytea($val);
$model->addFileImport($tmp, $data['email'], $escaped);
我的文件大约 100MB。 在 php.ini 设置中: memory_limit = 128M
但它仍然显示 errort:Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 133120 bytes) in... at row: $val = file_get_contents($mypath . '/' . $filename);
我已通过添加 ini_set('memory_limit', '-1'); 修复:
//$mypath . '/' . $filename <=> ../abc.csv
ini_set('memory_limit', '-1');
$val = file_get_contents($mypath . '/' . $filename);
$escaped = pg_escape_bytea($val);
$model->addFileImport($tmp, $data['email'], $escaped);
但它显示错误:
致命错误:C:\wamp\www\joomlandk\components\com_servicemanager\views\i0701\view.html.php 第 112 行内存不足(已分配 230686720)(试图分配 657099991 字节)
在行$escaped = pg_escape_bytea($val);
为什么?如何修复该错误?
【问题讨论】:
-
你的内存用完了,据我所知是物理内存。 657099991 字节是 626.659 兆字节。你最好的选择是use a bigger swap file。
标签: php