cPanel EasyApache 4 Installing Redis and Redis PHP extension

Posted one year ago

Installing Redis is relatively straight forward on centos servers, however the Redis PHP extension proved a little more problematic.

For CentOS 6 /RHEL 6

rpm -ivh
rpm -ivh
yum -y install redis --enablerepo=remi --disableplugin=priorities
chkconfig redis on
service redis start

For CentOS 7 /RHEL 7

rpm -ivh
rpm -ivh
yum -y install redis --enablerepo=remi --disableplugin=priorities
systemctl enable redis
systemctl start redis

Installing the Redis PHP extension for all available PHP versions
Note: paste the whole block!

for phpver in $(ls -1 /opt/cpanel/ |grep ea-php | sed 's/ea-php//g') ; do
cd ~
wget -O redis.tgz
tar -xvf redis.tgz
cd ~/redis* || exit
./configure --with-php-config=/opt/cpanel/ea-php"$phpver"/root/usr/bin/php-config
make clean && make install
echo '' > /opt/cpanel/ea-php"$phpver"/root/etc/php.d/redis.ini
rm -rf ~/redis*


All done, we now need to ensure EA pulls in the extension, this is the area I had problems with. Although everything was installed the module wasn’t getting picked up. If you run this block you should see an output saying it had been enabled across all PHP versions.

for phpver in $(ls -1 /opt/cpanel/ |grep php | sed 's/ea-php//g') ; do
echo "PHP $phpver" ; /opt/cpanel/ea-php$phpver/root/usr/bin/php -i |grep "Redis Support"