Skip to content

Instantly share code, notes, and snippets.

@wuliupo
Created January 13, 2017 11:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wuliupo/c2831fc7c6a48c48cc5da03ddf2446da to your computer and use it in GitHub Desktop.
Save wuliupo/c2831fc7c6a48c48cc5da03ddf2446da to your computer and use it in GitHub Desktop.
php-redis-on-windows
<?php
$host = 'test.kvstore.aliyuncs.com';
$port = 6379;
$user = 'username';
$pwd = 'password1234';
$key = 'the_stored_key';
$redis = new Redis();
if ($redis->connect($host, $port) == false) {
die($redis->getLastError());
}
if ($redis->auth($pwd) == false) {
die($redis->getLastError());
}
if ($redis->set($key, 'this is a test string. '.rand(100, 10000)) == false) {
die($redis->getLastError());
}
$value = $redis->get($key);
echo '<hr/>get data from Redis: '.$key.' = '.$value;
?>
@wuliupo
Copy link
Author

wuliupo commented Jan 13, 2017

Environment setup

[redis]
extension=php_igbinary.dll
extension=php_redis.dll

for PHP 7, http://pecl.php.net/package/redis/3.1.0/windows

@smunchi
Copy link

smunchi commented Jan 27, 2022

In windows how can i say redis to use igbinary?

how to enable igbinary serialization for redis in windows?
I am not able to do it in windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment