ok so I'm really confused about how Apache, PHP and WordPress memory allocation works.

For example in WordPress there is a config variable (define('WP_MEMORY_LIMIT', '64M');) for memory allocation which is typically set to 64M by default.

In addition PHP has a memory allocation in php.ini (memory_limit) which is set really low by default (e.g. 128M)

If I have a server with 2GB of ram how should I allocate memory to WordPress and PHP?


Should I set php memory to 2GB? The server is a VPS also running mysql, cpanel etc. so I'm thinking I should probably limit it to 1GB instead. Also, if I limit php memory to 512MB will it ever use more than 512M anyway?

Then, what about WordPress - should I set it to match the php limit?

If I have php set to 1GB of memory and 2 WordPress sites should I set each to 512MB - will WordPress obey the memory limit aswell?

Just trying to get a handle on my memory allocation strategy.

Many thanks!


1 Answer 1


Ouch. The limit is per thread and should definitely not set to a too high value, cause than one single script could knock out your machine. 64MB should be fine for must PHP applications, otherwise they should be rewritten ;)

  • ahhh - i forgot about threads :) of course!
    – Colm Troy
    Apr 11, 2011 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.