Skip to content

ernesthernandez/phpredis-php7

Repository files navigation

#Redis extension for PHP 7 PHP extension for interfacing with Redis.

Currently most of the PHP extension module on the official website of PHP PECL daily use are not adapted PHP7, which stems from PHP7 some new features in PHP5 and dependencies, and there are many differences, so many components require developers through developed over time to fit PHP7.

There is a respository with newer compiled versions of redis for PHP. See the link in: https://windows.php.net/downloads/pecl/releases/redis/

##Usage

  1. Select the corresponding component version of redis and unzip php_redis.dll file into php ext directory. C:\xampp\php\ext
  2. Open the php.ini configuration file, and add: extension=php_redis.dll
  3. Restart server
  4. Check if redis extension is loaded with phpinfo();

##Errors If you get: Uncaught exception 'RedisException' with message 'Redis server went away'

##Demo

$redis = new Redis();

$isSuccess = $redis->connect('127.0.0.1', 6379);

$redis -> set('foo', 'bar');

echo $redis -> get('foo'); // foo