jdoe@home-pc:~# apt-get install redis-server
jdoe@home-pc:~# systemctl enable [email protected]
jdoe@home-pc:~# apt-get update
jdoe@home-pc:~# apt-cache pkgnames | grep php7.4
jdoe@home-pc:~# apt install php7.4-redis
jdoe@home-pc:~# service apache2 restart
jdoe@home-pc:~# redis-cli
https://redis.io/download#installation
https://tecadmin.net/install-redis-ubuntu
Download
https://github.com/tporadowski/redis/releases
Tutorial
https://www.c-sharpcorner.com/article/installing-redis-cache-on-windows
https://www.phpflow.com/php/how-to-setup-redis-server-and-use-with-php
- Download
php_redis.dllfile from PECL libs. Download extension as per your current PHP version. - Copy the
php_redis.dlland paste to following folder in XAMPP Server extension directory(D:\XAMPP\php\ext). - Open the
php.inifile and addextension=php_redis.dllline into this file. - Restart XAMPP server
- Open phpinfo() of XAMPP server and search Redis, if found that means you successfully integrated Redis with PHP.
<?php
try {
// create redis instance
$redis = new \Redis();
// connect with server and port
$redis->connect('localhost', 6379);
// set key
$redis->set('user', 'John Doe');
// get value
$user = $redis->get('user');
print($user); // John Doe
} catch (Exception $ex) {
echo $ex->getMessage();
}
The XAMPP section is patently wrong and only enables the
php_redisextension - without some sort of binary that packagesredis-serverthere's nothing to connect to and it will result in the "No connection..." error described above. The unofficial binaries listed in the Windows section are at 2 major versions out of date and counting. It boggles my mind that the Redis devs haven't bothered to create an official binary for Windows when it's the most widely used platform for local development by a large margin.