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
- Log in to your cPanel server via SSH
- Run these commands to download the rpm files for Redis.
# 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
- 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.
- Run these commands to enable Redis.
# chkconfig redis on
- 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 :
- Log in to WHM with root access.
- Select the software option from the navigation menu.
- Click on Module Installers.
- Click Manage for PHP Pecl
The PHP Pecl Installer section will open.
Do you see the Find a “PHP PECL” Section? Good !
- Type “redis” in the Search Box and Click Go.
- 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.
- 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.