install php redis extension in aaPanel

To install php redis extension on aaPanel control panel, run

cd /usr/local/src
git clone https://github.com/phpredis/phpredis
cd /usr/local/src/phpredis
phpize
./configure
make
make install

If you get php-config not found error, you need to create a symlink. This is for server with PHP 7.4 installed, if your server have differnt version of PHP, you may need to change path.

ln -s /www/server/php/74/bin/php-config /usr/bin

Now continue the installation from “./configure” command, it will work.

To activate redis, edit php.ini

vi /www/server/php/74/etc/php.ini

At the end, add

extension=/www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/redis.so

The path to redis.so file (/www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/) may be differnt on your server. This path you will get after you run the command “make install”

[root@server3290 phpredis]# make install
Installing shared extensions:     /www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/
[root@server3290 phpredis]# 

You can verify php redis extension is installed with command

php -m | grep redis

To make redis extension available for web site, you need to restart php-fpm-74 service.

systemctl stop php-fpm-74
systemctl start php-fpm-74

You can find name of service file with command

ls -l /etc/init.d | grep php

To verify web sites have redis extension available, you can create a file with phpinfo() function, that will show following.

redis php extension aapanel

See aaPanel

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *