Memory Outages – Need PHP/WP/IT expert

On top of caching as many dynamic requests as possible through W3 Total Cache, I also had to modify my PHP configuration to behave nicely on my low memory web server. Before tweaking PHP, it would spawn too many PHP child processes, run out of RAM, hit the swap, and basically shut the entire server down.

I’m running Nginx and PHP5-FPM, but what fixed the problem for me was editing my PHP5-FPM configuration (in /etc/php5/fpm/php5-fpm.conf I believe) and reducing pm.max_children = 12 to pm.max_children = 10. I haven’t had any memory issues since making this change.

Your configuration will probably be different, but I’m sure there’s are similar configuration values for PHP that you can tweak to reduce memory usage.

To get an idea of what processes are sucking up your memory, use top if available and press SHIFT + M to sort by memory usage. When my server was having issues, I’d see a ton of php processes eating up resources.