Moved logo-centos-7distro again because I somehow managed to break MariaDB on Ubuntu.. So instead I’m back to Percona on CentOS, which I upgraded to v7 now. CentOS 7 WordPress with Percona and Redis! Mind you I am not running HHVM anymore so the site will be slower. Turns out there’s a memory leak when it comes to Crayon, the syntax highlighting plugin I use. I have to look for a nice caching solution, preferably using Redis..

UPDATE: Found my redis solution! https://github.com/BenjaminAdams/wp-redis-cache
Without being logged in the blog loads in 13ms now, that’s even faster than varnish 🙂

UPDATE: Turns out I was overloading my VPS and the dreaded OOM killer struck and killed Percona. So I’ve upgraded to a 2GB VPS and I’ve added DataDog monitoring to Nginx, Percona and Redis just to see what’s going on. Here’s an example of my dashboard at DataDog. It’s a bit of a build it yourself NewRelic and free up to 5 hosts!

 

 

This little tutorial will explain how to get Redis higher than 2.6 in Centos. I ran into the problem that CentOS only had version 2.4 in the normal repositories and it turned out Magento requires a Redis version higher than 2.6. The REMI repository has version 2.8 though, and it’s fairly easy to install that version.

To install the REMI repository check the following page first:
http://blog.famillecollet.com/pages/Config-en

UPDATE:
Then to quickly install the redis package without editing any repo files just use this command:

And skip all this:

To enable it you have to edit /etc/yum.repos.d/remi.repo and enable it:

Then you can install the updated redis version. You can optionally also disable the repo afterwards again just to make sure you don’t end up involuntarily updating many other packages (if you don’t want to..)

I get this error regularly setting up new nginx+php-fpm servers and I keep forgetting the fix.
So here’s another note-to-self..

  1. Check session save path
  2. Check permissions of the directory

    This should tell you which user owns the session dir, most likely this is NOT the same as your php-fpm user.
  3. Check user of php-fpm

    I have set php-fpm set as nginx user, so I gotta fix the owner of the session dir.
  4. Fix owner and/or permissions
  5. Restart php-fpm
  6. Test phpmyadmin again, it should work now

Just need to store this somewhere in case I need it again for work. This config will sync a (Magento) website to another server and exclude a few directories as well.

Lsyncd.conf

Lsyncd.exclude

Then we need to increase inotify.max_user_watches since we are dealing with a huge site (for after reboot):

And add at the end:

To change the running server without rebooting (this is not permanent unless to you changed sysctl.conf as well!)

Turns out OPCache is a bit faster than APC so we decided to go ahead and make the change. In CentOS it can be found in the EPEL repo. First we want to remove apc:

Then we install Zend OPCache:

UPDATE:
I have switched to installing php54 and then you will have to install through PECL itself:

If you get an error about phpize you will need php54-devel as well:

And re-run the pecl command.

If it then complains about a C compiler (configure: error: no acceptable C compiler found in $PATH):

And re-run the pecl command again.

And restart PHP-FPM:

You can find a nice status page like apc.php here:
https://github.com/rlerdorf/opcache-status

For quick installation use the following command to download the php file to a directory of your choosing:

Here’s a screenshot of it on one of our test servers:
OPCache on PHP 5.3

If you are coming from Debian/Ubuntu you are probably used to install build-essential.
In CentOS they use the following command instead: