When it comes to enhancing your website’s performance, Redis is a name that often comes up. If you are hosting your website on a cPanel server, knowing how to Install Redis along with the PHP Redis extension can be a game changer. Redis is an in-memory data structure store widely used as a caching system, database, and message broker. This tutorial will guide you step by step to Install Redis and the PHP Redis module on your cPanel server.

Installing Redis on a cPanel server is essential if you want to optimize your server’s speed and ensure faster response times for your websites, especially WordPress, Magento, or custom PHP sites. At Hostrago, we always recommend enabling Redis cache to accelerate web applications, reduce server load, and improve overall user experience. Now, let’s dive into the step-by-step installation process for Redis and the PHP Redis extension.

What is Redis?

Redis stands for Remote Dictionary Server, an open-source (BSD licensed) in-memory data store. It’s often used as:

  • A cache to speed up web applications.
  • A database supporting strings, lists, hashes, sets, and more.
  • A message broker in scalable and real-time systems.

By using Redis on your cPanel server, you can drastically reduce the time it takes for your application to retrieve data, making your websites significantly faster.

Why Install Redis on a cPanel Server?

Here are a few reasons why installing Redis on your cPanel server is beneficial:

  • Boost Website Speed: Redis can cache frequently accessed data.
  • Improve Database Performance: It reduces database load by serving cached queries.
  • Supports PHP Sessions: Storing PHP sessions in Redis is faster than file-based sessions.
  • Highly Scalable: Great for high-traffic sites needing faster data processing.

👉 Read More: Best Web Hosting In India – Hostrago

Prerequisites to Install Redis on cPanel

Before starting, ensure the following:

  1. SSH Access with root privileges to the cPanel server.
  2. EasyApache 4 installed on your cPanel server.
  3. A Stable Network Connection to download packages.

To Install Redis

Step 1: Log in to your cPanel Server via SSH

First, connect to your cPanel server using SSH as the root user.

Step 2: Download the Required RPM Files for Redis

Run the following commands to download the necessary rpm files:

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Step 3: Install Redis

Once the downloads are complete, install Redis using:

rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
yum install -y redis

With these commands, Redis will be installed on your cPanel server.

Step 4: Enable Redis to Start on Boot

To ensure that Redis starts automatically upon server reboot, run:

chkconfig redis on

Step 5: Configure Redis

Next, you’ll need to configure Redis settings by editing the configuration file:

vi /etc/redis.conf

At the end of the file, add these lines:

maxmemory 256mb
maxmemory-policy allkeys-lru

This configuration limits the maximum memory usage to 256MB and sets the eviction policy to allkeys-lru, which helps in efficiently managing cache memory.

To Install PHP Redis Extension

1. Log in to WHM with root access.

2. Select the Software > Module Installers option from the navigation menu.

Select the Software option

4. Click Manage for PHP Pecl.

Manage for PHP Pecl

5. Type “redis” in the Search box and click Go.

Search box and click Go

6. The search will return the appropriate PHP Redis module. Click Install.

Click Install

Final Step: Restart Apache and Redis Services

For all changes to take effect, restart Apache (httpd) and Redis using SSH:

service httpd restart
service redis restart

Final Thoughts

By following these steps, you can easily Install Redis and the PHP Redis extension on your cPanel server. Redis significantly boosts website speed, enhances database query handling, and supports advanced caching mechanisms essential for dynamic sites like WordPress, Magento, and Laravel.

If you need expert help or managed hosting solutions with Redis support, explore our services at Hostrago Hosting Plans.

Categorized in:

cPanel,