This guide assumes that you have php cli installed and you have php version > 7.

To check your PHP version:

⚡ php -v
PHP 7.1.1 (cli) (built: Feb 13 2017 10:05:49) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.1, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans

Installation

cd /tmp

wget https://github.com/phpredis/phpredis/a
rchive/php7.zip -O phpredis.zip

unzip -o /tmp/phpredis.zip && mv /tmp/phpredis-* /tmp/phpredis && cd /tmp/phpredis && phpize && ./configure && make && sudo make install

Now check your php.ini location using the command:

⚡ php -i | grep php.ini

you’ll get output like:

/your/path/to/php.ini

run the following command:

sudo echo "extension=redis.so" >> /your/path/to/php.ini

To check if you have redis extension loaded, run the command:

⚡ php -i | grep Redis
Redis Support => enabled
Redis Version => 3.0.0-rc1

Restarting Redis

To restart redis, you need to AUTH from redis-cli and run:

shutdown

then exit, run

service redis start

To find the password for your current redis installation, open the following file:

vim /etc/redis/6379.conf

search for the line required pass

Run Redis commands from command line without logging to redid-cli

To run a redis command from command line:

Show all keys:

/usr/bin/redis-cli keys '*'

Remove all keys:

/usr/bin/redis-cli FLUSHDB

Further info:

  • http://stackoverflow.com/questions/7537905/redis-set-a-password-for-redis
  • http://stackoverflow.com/questions/6910378/how-can-i-stop-redis-server