Question

Ubuntu 12.04 x64 ~ LEMP+WordPress: PHP keeps crashing

Posted October 28, 2013 6.2k views
Hi folks, I'm running a 512MB RAM droplet with 2 separate single WP installs. Both vhost configs are identical. One of them is very new with just 6 posts so far. The other has been around since Dec '12. I need some help here. For the life of me, I can't figure out why PHP keeps crashing. I had the same problem with PHP5.3 + APC. Now I'm on PHP5.5 with ZendOpcache. I have to keep checking my site every now and then and login via SSH to restart PHP. Doesn't sound right to me. i. repository ppa:ondrej/php5 ii. repository ppa:nginx/stable If someone could take a look at my configs and let me know what's not right, will be greatly appreciated. I'm new to VPS have moved from a cPanel Shared Hosting. I like to seed now and hate to return to shared hosting should things not work out for me. 1. /etc/nginx/nginx.conf: http://pastebin.com/A6GTZkwx 2. /etc/nginx/sites-available/mydomain: http://pastebin.com/GiiCLX0L 3. /etc/php5/fpm/php.ini: http://pastebin.com/AYQSae6v I'm prepared to move the newer WP install to a shared host if required. I am currently not running W3TC or CloudFlare. I reckon I should be sorting out the crashing PHP before all else.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
10 answers
Have you installed swap (MySQL eats up a lot of resources)? If not, check out How To Add Swap on Ubuntu 12.04.
by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on Ubuntu 12.04
Hi Pablo, not yet but I will look into that. I have up the ZendOpcache memory from 128M default to 256M. It's probably gonna delay the issue at best I think.
If it's performance you're interested in, you may want to check out How To Install Wordpress, Nginx, PHP, and Varnish on Ubuntu 12.04.
by Etel Sverdlov
Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the server itself if there is a need for an active process. This tutorial covers installing wordpress on a LEMP stack (with nginx instead of apache), and then installing varnish.
@Nicholas: I don't recommend doing that on a 512MB droplet. 256MB of free RAM isn't enough for MySQL -- it'll crash. Try adding swap and/or upgrading your droplet.
@Kamal. Thanks for your input. I actually set ZendOpcache to 192MB and installed Varnish as suggested by Pablo. Seems like PHP is holding and hasn't crashed.

Does Varnish stop WordPress/PHP from caching? If so. does that mean my FastCGI settings are messed up in the first place?

Be great if some could take a look at my configs and let me know if something is out of place. I haven't installed swap yet. Upgrading is a possibility I guess but be silly if PHP still crashes after that...
Varnish acts as a reverse proxy and does not affect php5-fpm's behavior at all. You can upgrade your droplet temporarily and see if that fixes it. Since billing is hourly it will cost you next to nothing :]
@Kamal, yeah I could do that. Erm, noob question. How do I temporarily switch off varnish for the test?
You can just browse to http://yourip:nginxport
Guys, thanks for the help. PHP seems to be holding with Varnish installed. http://wp.me/pc4Vf-2b
Submit an Answer