3

I have a WordPress installation. When the ownership of the folder is root, the memory consumed is okay. However, when I change the ownership to the www-data user, it starts consuming a lot of memory and starts throwing a lot of out of memory error. I have changed the ownership to root. Why does this happen?

Peter Mortensen
  • 2,319
  • 5
  • 23
  • 24
Arc
  • 81
  • 5
  • Who is throwing out of memory error - PHP or apache? – L.R. Mar 14 '10 at 17:35
  • It actually gives an error with a random PHP line number. It seems like a PHP error. But it says out of memory and throws the error – Arc Mar 14 '10 at 20:19
  • can you show the PHP error and the log information? – Richard June Mar 14 '10 at 21:02
  • Specifically, what process is **it** that consumes all your memory? – Zoredache Mar 14 '10 at 22:51
  • Is this a stock up-to-date wordpress install? I have seen some really badly written templates that do really stupid things and cause havoc. – Zoredache Mar 14 '10 at 22:53
  • The install is up to date. Apache only consumes memory. ============================================================= 3143 www-data 15 0 67660 22m 13m S 0 4.4 0:00.35 apache2 ==================================================================== 3145 www-data 16 0 72272 28m 14m S 0 5.6 0:07.75 apache2 =============================================================== I am unable to reproduce the error right now but it throws PHP error on random lines in different plugins. – Arc Mar 15 '10 at 09:46
  • so apache is using 13 and 28 megabytes of RAM, and you're worried about its usage? – warren Mar 17 '10 at 12:49
  • I told you I was not able to reproduce the error. It takes much more memory at times. – Arc Mar 17 '10 at 16:09
  • It doesn't. How are you measuring the memory usage? – Josh Budde Feb 22 '11 at 17:49
  • It is happening for me. I am trying "top" on the console. Also the the Wordpress Dashboard starts throwing error. – Arc Feb 22 '11 at 17:49

2 Answers2

4

It is likely to be a memory leak in an installed and enabled plugin.

For example, the wp-super-cache plugin is known to cause problems , like this.

The best approach would be to disable all plugins and themes and then measure memory usage again. Assuming this fixes your problem you can then enable each plugin and theme again to see what effect they have on memory usage.

EDIT: I have found an example of this here, where the ownership of the files in the cache were changed it caused a memory leak as you have described.

In your particular case you first ran this wordpress installation as root, effectively creating files with an ownership that is not writeable by the web server.

You should be able to correct ownership on these files in the cache to resolve your problem.

Of course it may not be the wp-super-cache plugin that is causing your issue. You have not yet posted back if disabling plugins had any effect so I am still working on that assumption.

Richard Holloway
  • 7,256
  • 2
  • 24
  • 30
  • 1
    I totally agree. I manage a farm of wp sites and buggy plugins cause the majority of problems i see. Do what Richard says and i bet you'll find the problem. – anonymouse Mar 18 '10 at 01:10
  • If www-data owns the folders/files then that means PHP can create new files which means that wordpress can waste time and memory working with the filesystem. – Xeoncross Mar 24 '10 at 03:35
0

When you change directory ownership, are you effectively denying write access for www-data? Or, are you setting permissions such that www-data can still write to the WordPress install? Also, are you hitting PHP's memory limit or are you hitting a system wall?

When you run it with root ownership, do you see any errors in your web server logs that indicate a problem writing to disk that you don't see when running with www-data ownership?

Richard up there is probably right. My guess is that root ownership is preventing Wordpress from doing some caching or other file dependent task because it can't write to the local file systems. That failure keeps it from eating up too much memory. When ownership allows writes, it's allowed to do whatever it is that it's doing and it bombs.

McJeff
  • 2,019
  • 13
  • 11
  • The extreme memory usage happens when the ownership is with the user www-data. When the permission is with root it works fine.I will check the plugin problem thing next. – Arc Mar 18 '10 at 12:46