Memcached is an open-source, high-performance, superfast in-memory key-value store and caching service. It is used to speed up web applications by caching session data, user authentication tokens, and API calls. It also helps when sharing a large amount of data across multiple application instances. It is used by some major companies including Facebook, Youtube, and Twitter. Memcached is multithreaded and scales vertically.

In this post, we will show you how to install Memcached on Rocky Linux 10.

Step 1 – Install Memcached on Rocky Linux 10

By default, the Memcached package is included in the Rocky Linux 8 default repo. You can install it by just running the following command:

dnf install memcached libmemcached -y

Once the Memcached is installed, you can see the detailed information of Memcached with the following command:

rpm -qi memcached

Sample output:

Name        : memcached
Epoch       : 0
Version     : 1.6.23
Release     : 7.el10
Architecture: x86_64
Install Date: Tue 21 Oct 2025 01:18:32 AM EDT
Group       : Unspecified
Size        : 477599
License     : BSD-3-clause AND Zlib AND BSD-2-Clause AND LicenseRef-Fedora-Public-Domain
Signature   : RSA/SHA256, Thu 22 May 2025 05:07:12 PM EDT, Key ID 5b106c736fedfc85
Source RPM  : memcached-1.6.23-7.el10.src.rpm
Build Date  : Fri 01 Nov 2024 11:25:14 AM EDT
Build Host  : pb-6720739d-5195-43e0-967e-8c214d0af718-b-x86-64
Packager    : Rocky Linux Build System (Peridot) <[email protected]>
Vendor      : Rocky Enterprise Software Foundation
URL         : https://www.memcached.org/
Summary     : High Performance, Distributed Memory Object Cache
Description :
memcached is a high-performance, distributed memory object caching
system, generic in nature, but intended for use in speeding up dynamic
web applications by alleviating database load.

Step 2 – Manage Memcached Service

You can manage the Memcached service easily via systemd. To start the Memcached service, run the following command:

systemctl start memcached

To enable the Memcached service to start after the reboot, run the following command:

systemctl enable memcached

To check the status of the Memcached service, run the following command:

systemctl status memcached

Sample output:

● memcached.service - memcached daemon
     Loaded: loaded (/usr/lib/systemd/system/memcached.service; disabled; preset: disabled)
     Active: active (running) since Tue 2025-10-21 01:18:53 EDT; 3s ago
 Invocation: e75fe0213cd443cd949c1c2c00b5154c
   Main PID: 132666 (memcached)
      Tasks: 10 (limit: 24809)
     Memory: 1.7M (peak: 1.9M)
        CPU: 16ms
     CGroup: /system.slice/memcached.service
             └─132666 /usr/bin/memcached -p 11211 -u memcached -m 64 -c 1024 -l 127.0.0.1,::1

Oct 21 01:18:53 rocky systemd[1]: Started memcached.service - memcached daemon.

Step 3 – Configure Memcached

The Memcached default configuration file is located at /etc/sysconfig/memcached. You can edit it with the following command:

nano /etc/sysconfig/memcached

The default configuration is shown below. You can change it per your requirements:

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1"

Save and close the file then restart the Memcached service to apply the changes:

systemctl restart memcached

Step 4 – Integrate Memcached with PHP-Based Applications

You can use Memcached as a caching service for all PHP based applications. You can do it by installing the Memcached extension for PHP.

Install the Memcached PHP extensions using the following command:

dnf install php php-cli php-pecl-memcache php-pecl-memcached -y

Step 5 – Verify Memcached for PHP

To verify the Memcached integration with PHP, you will need to install the Nginx web server package to your server.

dnf install nginx -y

Next, create a info.php file with the following command:

nano /var/www/html/info.php

Add the following code:

<?php
phpinfo();
?>

Save and close the file, then create a symbolic link to the info.php file in the Nginx default web root directory:

ln -s /var/www/html/info.php /usr/share/nginx/html/

Next, restart the Nginx service to apply the changes:

systemctl start nginx

Now, run the following command to verify the Memcahced:

php /var/www/html/info.php | grep memcache

You will see the below output.

memcache.session_redundancy => 2 => 2
memcache.session_save_path => no value => no value
memcached
memcached support => enabled
libmemcached-awesome version => 1.1.4
memcached.compression_factor => 1.3 => 1.3
memcached.compression_level => 3 => 3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
As you can see, both Memcache and Memcached PHP extensions are enabled.

Conclusion

In the above post, you learned how to install the Memcached service on Rocky Linux 10. You also learned how to integrate Memcached with PHP applications. You should now be able to use Memcached to speed up your web applications – give it a try on VPS hosting from Atlantic.Net!