Redis Install

BillyS

Verified User
Joined
Jul 17, 2021
Messages
464
Are there instructions in terms of how to get Redis installed and working? I have tried this approach:

https://help.poralix.com/articles/install-pecl-extension-for-php-directadmin-server

I have also tried to install redis through CustomBuild and have added it to php, so I know it's there and working, but I cannot find a redis.conf file. I can start redis, but not as a service. I am running RockyLinux / Centos 8.

When I check status from WordPress / Litespeed Cache, it says Redis is enabled, but it cannot connect. When I log into the server and start redis, this shows as connected. But as soon as I exist (Control C), redis shuts down.

Any help is appreciated. Glad to read up on how to do this, just struggling because most talk about modifying a redis.conf file and I cannot find on on the server using find -name redis.conf.

Bill
 
Last edited:
I install phpredis (with IGBinary) manually from source, without PECL or anything. Works best for me, it only takes a couple of minutes to install and verify.

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

Change your preferences in /etc/redis.conf. Then install PHPredis

  • IgBinary:
    • https://github.com/igbinary/igbinary/releases
      • Download latest release for example in /root/php_ext/igbinary
        • tar -xzf *latest_release.tar.gz*
        • cd *latest_release.tar.gz*
        • /usr/local/php80/bin/phpize80
        • ./configure CFLAGS="-O2 -g" --enable-igbinary
        • make
        • make test
        • make install
  • PHPRedis:
    • https://github.com/phpredis/phpredis/releases
      • Download latest release for example in /root/php_ext/phpredis
        • tar -xzf *latest_release.tar.gz*
        • cd *latest_release*.tar.gz
        • /usr/local/php80/bin/phpize80
        • ./configure --enable-redis-igbinary --with-php-config=/usr/local/php80/bin/php-config80
        • make
        • make install

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

In this file add this

Code:
extension=igbinary.so
extension=redis.so

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

Code:
php --ri redis
or
php -m

The same install instructions can be found on the GitHub readme for IGBinary and PHPRedis. You need to manually check for updates for igbinary and phpredis, for example with every PHP update.
 
Thanks for posting this, I really appreciate the thoughtful response. Just in caser someone else runs into this problem, let me go through what I did too. First I followed the advice in found on another post here, which advised me to follow the instructions here:

https://help.poralix.com/articles/install-pecl-extension-for-php-directadmin-server

That got everything working, but only if I started the server manually using the full path to redis-server, but once I existed using, the server would shut down. I was running a WordPress site with openlitespeed and the plug in and it verified I was connected, so I knew I was close. I thought maybe if I configured DirectAdmin to use redis and built it using CustomBuild 2.0, that would work, but no good. Same result. The interesting thing was there was no redis.conf file anywhere (I searched using find). So I gave up and ran
Code:
dnf install redis
systemctl start redis.service
systemctl enable redis

All is good, I think, everything seems to be working at least. I made some tweaks to redis.conf and fingers crossed it will keep working.
 
Back
Top