PHPRedis installation on DirectAdmin

PHPRedis with IGBinary is a powerful tool to increase your redis connections from PHP. Instead of using libraries likeĀ predis, you can install PHPRedis which is a C library. This dramatically improves the performance when using Redis with PHP. We’ll show you how to do the PHPRedis installation on DirectAdmin!

This tutorial is written for RHEL/CentOS/RockyLinux/AlmaLinux and other distros based on RHEL.

Install Redis with DNF

If you haven’t already installed Redis, you can do this easily with DNF:

dnf install redis
systemctl enable --now redis.service
systemctl start redis.service
chown:chown redis:redis /etc/redis.conf

The next step is to install the PHPRedis C library, with IGBinary as serialiser.

Install IGBinary

Download the latest release (tar.gz) from:

  • Download latest release for example in /root/php_ext/igbinary
tar -xzf *latest_release.tar.gz*
cd *latest_release.tar.gz*
./configure CFLAGS="-O2 -g" --enable-igbinary
make test
make install

Install PHPRedis

  • Download latest release for example in /root/php_ext/phpredis
tar -xzf *latest_release.tar.gz*
cd *latest_release*.tar.gz
./configure --enable-redis-igbinary --with-php-config=/usr/local/php80/bin/php-config80
make install

Add extensions to PHP config

cd /usr/local/php80/lib/php.conf.d
touch 20-custom.ini

If you use another PHP version, change it accordingly.

In this file, add:

And finally reload/restart php-fpm. Verify with:

php --ri redis


php -m

PHPRedis DirectAdmin Installation Check

If you see redis and igbinary in the list you have successfully installed the PHPRedis C extension with IGbinary as serialiser to your PHP installation!