Install the Memcached daemon
Memcached is a free and powerful object caching system that you can install to improve the performance of your website. Memcached will only work if you install the daemon, install the PHP libraries and configure your PHP application properly.
On CentOS servers, installing the Memcached daemon is done from the command line and is independent of any control panel you may be using (WHM/cPanel or Plesk).
- Enable administrator access on your Gen 3 or Gen 4 server if you haven't already done so.
- Connect to my server with SSH (Secure Shell).
- Switch to the root user.
- Install Memcached using YUM.
yum -y install memcached
- Configure Memcached to start automatically at boot time.
systemctl enable memcached
- Change the Memcached configuration to make the service more secure and to configure the amount of RAM to allocate.
- Edit the configuration file with your favorite text editor.
- It's important to update the OPTIONS line to bind Memcached to localhost and to disable UDP traffic, protecting from certain attacks.
- You also need to configure CACHESIZE to the amount of RAM you'd like to use. This depends on how much total RAM the server has, but 512M to 1024M is often a good place to start.
This is how the configuration file looks by default:
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS=""
OPTIONS="-l 127.0.0.1 -U 0"
- Once the file is modified, it should look something like this.
- Save the file.
- Restart Memcached to reflect your changes.
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="1024" OPTIONS="-l 127.0.0.1 -U 0"
systemctl restart memcached
- Move on to Install the Memcached PHP Libraries using WHM/cPanel.
- Move on to Install the Memcached PHP Libraries using Plesk.
- Our server experts can perform these steps for a fee. For more information about our Expert Services, please visit our Expert Service menu.