Since we moved to PHP 5.5 and it’s built in zend opcache, we decided to stop using APC.
Since zend opcache filled opcaching need only, we needed something for data-cache. There is one APC fork trying to extract data-caching code on Github. But we wanted something stable and mature so we choose to go with memcache.
Actually for our trivial needs both extensions should work fine. But we (forced) to choose php5-memcache as w3-total-cache doesn’t support only this!
apt-get install memcached php5-memcache service php5-fpm restart
Increase Max Memory memcache can use
By default, its 64MB. You may need more.
- Look for value
- Change it to
- Restart memcached
service memcached restart
Move PHP’s session storage to memcache
Add following lines:
session.save_handler = memcache session.save_path = "tcp://localhost:11211"
Extra: Since memcached can works in multiserver mode, you can share session across server. Google for more info on this. I will post our config when we will write one! 😉
Changes in w3-total-cache plugin
In w3-total-cache plugin you need to choose memcache as backend for object-cache and database-cache.
Web-based Stats Viewer for Memcache
There are many but we choose phpmemcacheadmin
cd /var/www/example.com/htdocs/ mkdir mem && cd mem wget http://phpmemcacheadmin.googlecode.com/files/phpMemcachedAdmin-1.2.2-r262.tar.gz tar -xvzf phpMemcachedAdmin-1.2.2-r262.tar.gz chmod +r * chmod 0777 Config/Memcache.php