How to install redis extension for php 7

Prashant G Patil picture Prashant G Patil · Oct 26, 2017 · Viewed 62.2k times · Source

Referred this link https://anton.logvinenko.name/en/blog/how-to-install-redis-and-redis-php-client.html

And done following steps

PhpRedis for PHP 7 (Skip it if you have different PHP version)

Install required package

apt-get install php7.0-dev

Download PhpRedis

cd /tmp
wget https://github.com/phpredis/phpredis/archive/php7.zip -O phpredis.zip

But, https://github.com/phpredis/phpredis/archive/php7.zip file not found for installation.

Answer

schellingerht picture schellingerht · Oct 26, 2017

Yesterday, I installed Redis on my Vagrant box (/etc/php/7.0):

  • sudo pecl install redis
  • sudo service php7.0-fpm restart

(optional: run php -m for listing the php modules).

Now, you can use the Redis class in your php code.