Skip to main content

WHM: How to Install Redis and the Redis PHP Extension Using EasyApache 4

This article will guide you through installing Redis and the Redis PHP extension using WHM’s EasyApache 4 via SSH.

Justin Catello avatar
Written by Justin Catello
Updated yesterday

This is a quick guide on how to install both the Redis PHP extension as well as the daemon via SSH.

Installing the Redis daemon:

for CentOS 6/RHEL 6

rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum -y install redis --enablerepo=remi --disableplugin=priorities
chkconfig redis on
service redis start

for CentOS 7/RHEL 7

rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum -y install redis --enablerepo=remi --disableplugin=priorities
systemctl enable redis
systemctl start redis

Installing the Redis PHP extension for all available versions of PHP.
Copy and paste the entire block into SSH, don't do line by line.

cd ~
wget -O redis.tgz https://pecl.php.net/get/redis
tar -xvf redis.tgz
rm -f redis.tgz
cd ~/redis*

for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
/opt/cpanel/"$phpver"/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/"$phpver"/root/usr/bin/php-config
make clean && make install
echo 'extension=redis.so' > /opt/cpanel/"$phpver"/root/etc/php.d/redis.ini
done

/scripts/restartsrv_httpd
/scripts/restartsrv_apache_php_fpm

All done! Check to make sure the PHP extension is loaded in each version of PHP:
Copy and paste the entire block into SSH, don't do line by line.

for phpver in $(whmapi1 php_get_installed_versions|grep -oE '\bea-php.*') ; do
echo "PHP $phpver" ; /opt/cpanel/"$phpver"/root/usr/bin/php -i |grep "Redis Support"
done

Output should be:

PHP 55
Redis Support => enabled
PHP 56
Redis Support => enabled
PHP 70
Redis Support => enabled
PHP 71
Redis Support => enabled


Congratulations! You have successfully installed Redis and the Redis PHP extension using EasyApache 4 in WHM.

If you have any questions, please don’t hesitate to contact our team via live chat.

For technical inquiries, please feel free to reach our support team by emailing support@bigscoots.com from your registered email or by submitting a support ticket.

Did this answer your question?