The following steps show you how to use memcache in magento 2 in ubuntu
Step 1: To install and construct the memcached on ubuntu .
Step 2: to construct magento to use memcached.
To install and construct the memcached on ubuntu
As a user with root rights ,enter the following commands
apt-get -y update apt-get -y install php5-memcache memcached
Modify the memcached configuration setting of CACHESIZE and –I:
- Open /etc/memcached.con in the text editor.
- Place the –m parameter and modify its value to alteast 1GB
- Save your changes to memcached.conf and exit text editor
- Restart memcached.
- Regenerate Service memcached
To construct magento to use memcached
- Open <your Magento install dir>/app/etc/env.php
- set the following
'session' => array ( 'save' => 'files', ), Change it as follows: 'session' => array ( 'save' => 'memcache', 'save_path' => 'tcp://<memcache ip or host>:<memcache port>' ),
To verify memcached works with magento:
- Erase the contents of the following directories under your Magento installation directory:
rm-rf-Var/cache/* var/page_cache/* var/session/*
- go to any page on the storefront
- log in to Magento Adminstration and browse to more pages
- If no error display, well done! Memcached is working
I hope the following guidelines help you use memcache in magento 2 in Ubuntu.
Leave a Reply