How fix Fatal error: Out of memory (allocated ) (tried to allocate bytes) in php
<p>I read value of a file csv as:</p>

<pre><code> //$mypath . '/' . $filename &lt;=&gt; ../abc.csv
 $val = file_get_contents($mypath . '/' . $filename);                                       

 $escaped = pg_escape_bytea($val);

 $model-&gt;addFileImport($tmp, $data['email'], $escaped);
</code></pre>

<p>My file ia about 100MB.
In php.ini setting :
memory_limit = 128M</p>

<p>But it still show errort<code>:Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 133120 bytes) in...</code> at row:   <code>$val = file_get_contents($mypath . '/' . $filename);</code>     </p>

<p>I had fixed by add   <code>ini_set('memory_limit', '-1');</code>: </p>

<pre><code> //$mypath . '/' . $filename &lt;=&gt; ../abc.csv
      ini_set('memory_limit', '-1');
     $val = file_get_contents($mypath . '/' . $filename);                                       

     $escaped = pg_escape_bytea($val);

     $model-&gt;addFileImport($tmp, $data['email'], $escaped);
</code></pre>

<p>But it show error :<code>Fatal error: Out of memory (allocated 230686720) (tried to allocate 657099991 bytes) in C:\wamp\www\joomlandk\components\com_servicemanager\views\i0701\view.html.php on line 112</code> at row   <code>$escaped = pg_escape_bytea($val);</code>
Why? How fix that error?</p>
