Home WebServer PanelDirectAdmin How to install Memcached on DirectAdmin

How to install Memcached on DirectAdmin

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

In this article, AZDIGI will guide you to install Memcached on DirectAdmin to help speed up your website.

I. Overview

Memcached is a system storing copies of objects and data accessed multiple times to speed up access. It is commonly used to optimize data loading from the database for web-based applications. Initially, the memcached system was developed by Danga Interactive and used for LiveJournal. Then memcached became popular and used on other websites.

Memcached is highly scalable, based on key-value stores value and object whenever RAM is available for the fastest access, without having to access databases or resources raw on the hard disk.

II. Steps to install Memcached on DirectAdmin

To install Memcached on DirectAdmin, follow these 3 steps:

Step 1. SSH into the Server/VPS system

To install Memcached on DirectAdmin, we first need to SSH or access your VPS/server with root privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:

Step 2: Install the Memcached service

To install Memcached on DirectAdmin, you need to install the memcached service, we will use the yum command to install:

AZDIGI Tutorial
yum install memcached -y
    
install Memcached on DirectAdmin

AZDIGI Tutorial
systemctl start memcached
systemctl enable memcached
systemctl status memcached
    
install Memcached on DirectAdmin

Thus, completing the installation of Memcached on DirectAdmin, the next step is to install the php extension memcache to connect. Memcached listens to Port 11211, so you need to open port 11211 for this to work. If you are using CSF, you can refer to the following article to know how to use CSF:

To be sure, you can netstat check with port or services:

AZDIGI Tutorial
netstat -nltp | grep 11211
netstat -nltp | grep memcached
    
install Memcached on DirectAdmin

Step 3: Install libmemcached and memcached module

After installing Memcached on DirectAdmin, you need to install the libmemcached library and the memcached module to connect. I have consulted some documents on how to install Memcached on DirectAdmin, we need to manually install libmemcached and then install the memcached module. In this article, I guide you to use an available script to install memcached, memcached-devel, libmemcached-devel, libmemcached.

You run the following commands to install:

AZDIGI Tutorial
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
gunzip libmemcached-1.0.18.tar.gz
tar -xvf libmemcached-1.0.18.tar
cd libmemcached-1.0.18
./configure
cd /usr/local/directadmin/scripts/custom
wget https://raw.githubusercontent.com/poralix/directadmin-utils/master/php/php-extension.sh -O php-extension.sh
chmod 750 php-extension.sh
./php-extension.sh install memcached
    

When you finish running the install memcached command, you will see a path Installing shared extensions /usr/local/php7x/lib/php/extensions/no-debug-non-zts-20180731/ as shown below. Open the php.ini file and add the extension memcached.so:

install Memcached on DirectAdmin

Use the command php -i | grep php.ini to search for the loader file php.ini. Then scroll to the bottom of the file and add extension=memcached.so as shown below:

install Memcached on DirectAdmin

To check memcached operation, use the following command:

AZDIGI Tutorial
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
gunzip libmemcached-1.0.18.tar.gz
tar -xvf libmemcached-1.0.18.tar
cd libmemcached-1.0.18
./configure
cd /usr/local/directadmin/scripts/custom
./php-extension.sh status memcached
    
CleanShot 2020 10 17 at 13.39.23@2x

Another method to check the memcached extension is to create an info.php file and check it as shown below. Go to the directory containing the source code, create a new file named info.php and paste the following code:

<?php
phpinfo();
?>

After creating the file info.php, go to mydomain/info.php to check:

CleanShot 2020 10 17 at 14.47.57@2x

Step 4: Configure Memcached on the website

After installing Memcached on DirectAdmin is complete, let’s configure Memcached on the website. In this article, I use the LiteSpeed Cache Plugin to configure because, by default, Litespeed cache has built-in support for memcache and Redis via TCP connection.

You open LiteSpeed Cache => Cache => Object and turn it on and enter the following:

  • Object Cache: ON
  • Method: Memcached
  • Host: localhost
  • Port: 11211. By default, memcached uses this port.
CleanShot 2020 10 17 at 15.11.58@2x

III. Summary

Hopefully, this article will be informative and useful to you after installing and using it. In fact, when using memcached, my website works very well. So try to experience it.

If you need support, you can contact our Technical Department for the fastest support.

You can see more useful articles about DirectAdmin at the following link:


If you need assistance, you can contact support in the ways below:

  • Hotline 247: 028 888 24768 (Ext 0)
  • Ticket/Email: You can use your email to register for the service and send it directly to: support@azdigi.com
Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign