Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!


share|improve this question
up vote 2 down vote accepted

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 ;)

share|improve this answer
ahhh - i forgot about threads :) of course! – Ed Bloom Apr 11 '11 at 19:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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