allowed memory size of 104857600 bytes exhausted (tired to allocate 64 bytes) Error coming

20 views
Skip to first unread message

anjith

unread,
Apr 19, 2009, 3:23:50 AM4/19/09
to Professional PHP Developers
Hi,

allowed memory size of 104857600 bytes exhausted (tired to allocate 64
bytes) Error coming

Thanks anjith

Dheeraj Kumar Aggarwal

unread,
Apr 19, 2009, 4:32:38 AM4/19/09
to Professi...@googlegroups.com
Hi

increase the memory_limit option in your php.ini file
--
Regards,
Dheeraj

Bobby Easland

unread,
Apr 19, 2009, 7:54:31 AM4/19/09
to Professional PHP Developers
Don't just arbitrarily increase the php.ini settings to accomodate a
file upload. That message is coming from trying to open a file and
place it entirely in memory (given your previous postings). Use a
file pointer and iterate over each line to minimize the resource
usage.

During a file upload it is chunked into a temporary directory so would
not consume more than 1MB of RAM at a time before that portion is
flushed to the temp file.

The bottom line is not to open a 100 MB file with functions like
file_get_contents() and the like because it attempts to place the
entire file in memory. However, when you should use fopen/fread/
fclose or SplFileObject instead it uses a pointer which is faster, has
a smaller memory footprint, and makes it much easier to seek or read.

--
Bobby Easland
http://www.oscommerce-freelancers.com/

On Apr 19, 4:32 am, Dheeraj Kumar Aggarwal <dheerajcom...@gmail.com>
wrote:
> Hi
>
> increase the memory_limit option in your php.ini file
>

adi

unread,
Apr 20, 2009, 5:23:07 AM4/20/09
to Professi...@googlegroups.com
hi
try setting the ini setting of memory_limit =-1 to disable memory limits


regards,
adi

C. (http://symcbean.blogspot.com/)

unread,
Apr 20, 2009, 8:26:22 AM4/20/09
to Professional PHP Developers
On 20 Apr, 10:23, adi <a...@lspl.net> wrote:
> hi
> try setting the ini setting of memory_limit =-1 to disable memory limits
>
> regards,
> adi
>

... then stand back and watch your webserver get DOSed.

Find out what's using the memory and fix the problem, not the symptom.
Well written transactional PHP code should run happily in 16M or less
- if you need more than 100Mb there's something wrong with your
application.

C.
Reply all
Reply to author
Forward
0 new messages