How to fix Wordpress + VPS memory problems



Step 1:

Ignore what Dreamhost Support tells you. PHP 5.2 fastcgi is the problem, not the solution.

Step 2:

Go to all of your wordpress domains and change the default PHP from

PHP 5.2 Fastcgi


PHP 5.3 cgi

Optional Steps

Step 3:

Setup Cloudflare

Step 4:

Setup W3 Total Cache

Example results.

Here is my site before and after the switch to PHP 5.3 cgi. The drop in memory usage is HUGE! I have cut my max from 600mb to 300mb and I am experiencing no problems with my VPS getting killed.

(why isn’t the image displaying?)



I’m doing a change now.

Thank you.


Hi edmarrp!

I’d love to know how this works out for you.


W3 Total Cache is (I know) complicated, but once you master it, it’s amazing :slight_smile:

WP Super Cache, if you’re on shared hosting, combined with WP Minify, is also pretty good :slight_smile:


Simply amazing…I just moved to a VPS, and after the free week reverted back to the 300MB resource level. Almost immediately I began to receive notifications about being over my resource limit, and even had my VPS restarted for me…all very disconcerting since this site gets very little traffic.

I simply switched to 5.3 CGI and presto! I am now around 22MB in actual memory and 55 in cached or about 1/3 of what it was before.

Thanks for the tip!


PHP 5.3 is totally better, but there is one (and only one) reason I ever suggest it.

If you want xCache, you need to either install it manually or use 5.2 :confused:


I’d like OP to name one guy at Support who would tell anyone not to update to 5.3 at the time of this thread. I know at least one DH coder was pushing hard for everyone to switch when he was one of the very few “Verified by Dreamhost” voices here at the forum.

Cloudflare + Total Cache = slightly more than zero weight on localhost. Server seems to run better? /amazed

XCache runs like a dream on 5.4, let alone 5.3, and it runs on shared (all versions) without a hiccup. If MO0 read anything different he’d probably have a cow.

File cache’ing - tweak jpcache to suit. The rest is just bloatware that’s doing nothing but harassing your io with never-was stats while hooking into a hook it had previously hooked into just to write some unnecessary spam to your footer. But hey, it looks great if you right click and view source in that nublet browser with those 10 extensions that do nothing to help you actually speed anything up :slight_smile:


sXi: Yes xCache does run great :slight_smile: It’s installing it that’s a hurdle for a lot of people.


I realize that the original post is a bit old, but is it correct that domains running WP should switch to PHP 5.3 CGI instead of PHP 5.3 FastCGI?

That would seem to be consistent with this wiki article:

Is that article still accurate?

Are there any “gotchas” in switching from FastCGI to CGI?


CGI can be a bit slower under heavy load, and PHP opcode caches (like APC and xCache) don’t work with CGI.


Would a change from PHP 5.2 fastcgi to 5.3 CGI work on my shared hosting??


danielgc, yep! Go into your panel and click on Manage Domains. Edit the domain. You’ll see what options you have for PHP there (and 5.3 is an option on all shared hosting).


Thx! I will try it and let you know the results with gtmetrix :wink:


Has anyone figured out how to install XCache on VPS with the stock php5.4 option? I’ve spent 15 hours trying to figure out php.ini, phrc, etc, etc and am at the point where I’d rather spend money to pay someone to install it just to get the Opcode benefit.

I also hear APC is good for Wordpress on PS - anyone try this on php5.4?
I’d love to do an in-depth analysis of:

  • xcache + w3tc
  • apc + w3tc
  • no cache + w3tc



I’ve run APC and XCache on PHP 5.2, 5.3, 5.4 here at DreamHost.


What were your impressions between APC/Xcache on 5.2/3/4?
Would you suggest APC or XCache with 5.4?
Was your site using Wordpress, by chance?

4 times, I’ve “kinda sorta” installed APC, but then every single one of my websites turns into “It works!” page. No idea how to fix that. DH wiki is certainly not helping, save for the advice that I drop on a phrc file under home/.php/5.4/

[i]So, 4 times I have reset the state of my VPS. I have very little scripting experience, which is why I used XCache with php5.2 and mod_php ~

(I wish there was a one click option for 5.4 or at least 5.3; I’m considering paying someone, but not sure how to go about that.)[/i]

Curious about your performance, as it sounds like you have a complete and thorough experience using both popular opcode options on all of the php versions in the last few years.


Caching is caching. I’ve always been a bit of a fanboy for XCache - mostly because I respect how mO0 went off by himself to create it. I haven’t done any comparative testing at DreamHost as I don’t have any sites hosted here that would lend themselves to a good comparative test. And I’m on a shared server. The sites I tested opcode caching on here were basic WP and Drupal installations.


APC works better with mod_PHP than fast-cgi in my experience. I’ve been using it on one server for a while now. xcache does well on fast-cgi, though the sites I use it for have different audiences so the traffic isn’t really comparable.


Thanks for your input - it really helps.

I’m about to pay someone to install either XCache or APC and this helped me make the decision.
(I’d rather run fast-cgi as the permissions with mod_PHP kind of annoyed me.)

I’ve also read that Wordpress + XCache + php5.4 works very, very well, so I’ll be going that route thanks to your input. Does anyone know if Dreamhost offers paid services for installations or knows a site where I can request such a service? I have zero scripting or linux experience, but need Opcode for my VPS as soon as possible and I just can’t go back to php5.2 and mod_php just to get XCache.

DH Wiki specifically says that their support will not help with custom php installs, php.ini, etc - so I’m not really left with much option other than pay a professional.


Oh god, mod_PHP permissions will make me drink, but it has other benefits on that particular server (primarily speaking about non WP apps).

We do have a paid service for installs, but we don’t have someone handy for that sort of work. I’d rather not suggest it, knowing we probably can’t do what you need at this time. Generally when I need a WP related consultant, I look at but they’re high end a lot of the time.

sXi - do you have good resources? I know you’ve talked about it in passing before.