Question

Fatal error: Allowed memory size of 104857600 bytes exhausted (tried to allocate 32345609 bytes)

It mean I need 137203209 bytes memory limit to run my php script.
I got this error although I have the following code in the script.

 ini_set('memory_limit', 268435456); # 256 MB

The script is on my shared hosting server. I don't have access to php.ini. The memory_limit did work for other scripts in the same hosting server.

When I checked phpinfo() of my server, I see these

suhosin.memory_limit - 128
memory_limit - 100M

My script definitely needs more than 128M because it is a mail sending script with large file attachment.

Was it helpful?

Solution

suhosin.memory_limit - 128 does not allow you to increase memory limit higher that 128mb, set it to 268435456 to be allowed to increase memory_limit up to 256Mb. I doubt you can do it on a shared hosting, though, because you need an access to suhosin ini file (you can not do something like ini_set('suhosin.memory_limit', 268435456);).

More about suhosin.memory_limit

OTHER TIPS

You're on a shared host, and shared hosts almost never let you using the ini_set('memory_limit',XXX) functions (otherwise everyone would always try to grab the whole server memory and lock up the whole server). Check phpinfo() to see if safe-mode is on... it probably is.

Also, side-note: if you want to set the memory limit to 256MB in any case, you can just use the:

ini_set('memory_limit', '256M');

notation instead of writing out the whole integer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top