How To Install Redis and PHP Redis on a cPanel Server?

Hitori Tech

Redis and PHP Redis must be installed on a Linux-based server, which cPanel users administer. Software like this is indispensable for programmers working with PHP.

Redis is a free and robust in-memory database system. Also As a key-value store, it stores several data types, including strings, hashes, lists, sets, and sorted sets. Redis’ passive data caching method, which deletes old cache entries as new ones are added, makes it simple to store massive volumes of data without slowing down data transfers.

To Install Redis

  1. Log in to your cPanel server via SSH
  2. Run these commands to download the rpm files for Redis.
# wget

# wget
  1. Enter and run these Commands to install Redis :
# rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

# yum install –y redis

With this, You will have installed Redis on your Server.

  1. Run these commands to enable Redis.
# chkconfig redis on
  1. Open the redis.conf file and enter/copy these lines at the end of the file:
vi /etc/redis.conf

maxmemory 256mb

maxmemory-policy allkeys-lru

It’ll get Redis set up with the fundamentals on your server. So, it’s high time you set up the PHP Redis Extension.

To Install PHP Redis :

  1. Log in to WHM with root access.
  2. Select the software option from the navigation menu.
  1. Click on Module Installers.
  1. Click Manage for PHP Pecl

The PHP Pecl Installer section will open.

Do you see the Find a “PHP PECL” Section? Good !

  1. Type “redis” in the Search Box and Click Go.
  1. The Search will return the appropriate PHP Redis module, Click Install.

It will install the PHP extension that will act as an interface for Redis.

  1. Finally, run these command in the SSH:
# service httpd restart

# service redis restart

It will restart Redis and httpd for the changes to take effect.

With it, the installation of Redis and PHP Redis on your cPanel server will be complete.

Leave a Comment