What is the recommended php memory_limit?

Hi all, could you please share what is the recommended php memory_limit?

Because currently we are using 512M but still exhausted. Do we need to increase again or do we need to optimize and reduce relational AR usage?

Thank you very much.

wrm rgrds,


What PHP version are you using. If you use <= 5.3.0 you may find this interesting.

Wow great… Thanks for your information.

But if you have a web server with 8GB RAM, how much will you allocate for php?

Thanks a lot ^^

wrm rgrds,


Well if 512mb works then just leave it. I don’t know if it has any bad side-effect when you set it too high (like for eg to 4gb).

I’d say 512 MB is way too much for any site with some hits. Google a bit for PHP + Apache + Optimizing and how the memory_limit affects the resident memory that’s used by apache processes. In short: PHP module never releases the RAM it once used. There are some workarounds but as a basic principle you should try to let your PHP scripts consume as few memory as possible.

Whooow, this is really much for a standard php script!

I ran into such issues when generating excel files or stuff with libraries that keep everything in memory but if this happens all the time you should trace such an issue by using s.th. like the memory_ge[font="verdana"][size="2"][color="#000000"]t_usage [/color][/size][/font]function.

Best regards