This tutorial is a manual installation of redis php extension of PHP 8.1 under Ubuntu 22 server.
On your server terminal window, enter this command:
cd /tmp
wget https://pecl.php.net/get/redis-5.3.4.tgz
tar xf redis-5.3.4.tgz
cd redis-5.3.4
phpize
If you have this error phpize command not found:
Command 'phpize' not found, but can be installed with:
sudo apt install php8.1-dev # version 8.1.2-1ubuntu2.2, or
sudo apt install php-dev # version 2:8.1+92ubuntu1
simply install phpize with this command
sudo apt install php-dev
Run phpize again
phpize
./configure
sudo make install
Add redis to php
cd /etc/php/8.1/mods-available
sudo nano redis.ini
Paste this code, save and exit
extension=redis.so
Run phpenmod
sudo phpenmod redis
Check the changes
phpquery -v 8.1 -s apache2 -m redis
#redis (Enabled for apache2 by local administrator)
Restart apache
sudo service apache2 restart