Re: Memory Allocation Error
| From: | Per Jessen | Date: | Tue, 06 Nov 2007 08:23:08 +0000 |
| Subject: | Re: Memory Allocation Error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-264093@lists.php.net to get a copy of this message | ||
heavyccasey@gmail.com wrote:
> Hi!
>
> I have a script that reads a 120 MB remote file. This raises a Memory
> Allocation Error unless I use:
> ini_set('memory_limit', '130M');
>
> I doubt this is good for my server... I tried both fopen and
> file_get_contents. This used to work fine in PHP 4 until I upgraded to
> PHP 5.
>
> Any ideas?
If you need to keep a 120Mb file in core at any point in time, you'll
need the memory. Either adjust the memory-limit, or change your code
to process the file in chunks/lines/bytes.
/Per Jessen, Zürich