predisHow do I install and configure a PHP Redis DLL on a Windows machine?
- Download the latest version of the PHP Redis DLL from PECL.
- Extract the
php_redis.dll
from the downloaded archive and place it in theext
folder of the PHP installation directory. - Add the following line to the
php.ini
file:extension=php_redis.dll
. - Restart the web server.
- Test if the extension is loaded correctly by executing the following code:
<?php
$redis = new Redis();
if ($redis) {
echo "Redis is working";
}
Output example
Redis is working
- Configure the Redis server connection by using the
connect
method:
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
- Verify the connection by using the
ping
method:
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
echo $redis->ping();
Output example
+PONG
More of Predis
- How can I use the zscan command in PHP with Redis?
- How can I use PHP and Redis to retrieve a range of values from a sorted set?
- How do I use the hset array command in PHP with Redis?
- How can I use PHP and Redis to get multiple keys?
- How do I use the PHP Redis zrevrange command?
- How do I use the rpush command in PHP with Redis?
- How do I use yum to install php-redis?
- How can I use Predis with a cluster in PHP?
- How do I install PHP, Redis, and XAMPP?
See more codes...