0

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?

e.g.

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!

Ed

1 Answer 1

2

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

1
  • ahhh - i forgot about threads :) of course! Commented Apr 11, 2011 at 19:24

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.