Increasing the memory limit of the Apache Server

Many times when you are running a script you may encounter this

error message “Exhausted memory size of 42423423 bytes:Tried to allocate 16
bytes”;

You may wonder how to fix this and what’s the reason of it

Cause:When the scripts use too much memory or exhaust all the memory
allocated by the server
this error message would appear

There are actually two ways to fix this

a)By Editing php.ini file and changing the memory limit to higher than 8 MB.

b)By adding a line at top of your script

The second way is more convenient as it can be followed for scripts of our
choice

Add this below line at the top of the script

ini_set(”memory_limit”,”300M”);

This would fix most of your problems

This entry was posted on Sunday, August 16th, 2009 at 8:31 pm and is filed under Php. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Post a Comment