This is a guide to setup PhpRedis on an Ubuntu system. We'll also use the igbinary serializer for performance gains.

Run sudo apt install -y php-igbinary php-redis to install the modules. It will add configurations for the 2 modules in our mods-available directory (mine is located at /etc/php/7.3/mods-available).

Ensure your igbinary.ini looks like this:

; Load igbinary extension
extension=igbinary.so

; Use igbinary as session serializer
session.serialize_handler=igbinary

; Enable or disable compacting of duplicate strings
; The default is On.
igbinary.compact_strings=On

; If uncommented, use igbinary as the serializer of APCu
; (APCu 5.1.10 or newer is strongly recommended)
;apc.serializer=igbinary

Then run:

sudo phpenmod igbinary
sudo phpenmod redis
sudo a2enmod igbinary
sudo a2enmod redis
sudo service apache2 restart

You can see your PHP and Apache loaded modules via php -m and apache2ctl -M.

You should see redis and igbinary information in your phpinfo() output.