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 do I install PHP Redis on Ubuntu 20.04?
- How can I use PHP and Redis to retrieve a range of values from a sorted set?
- How do I use yum to install php-redis?
- How can I use PHP to increment values in Redis using ZINCRBY?
- How can I use PHP and Redis to retrieve data from a sorted set using ZRANGEBYSCORE?
- How do I use PHP and Redis together to create a transaction?
- How can I install and configure Redis on an Ubuntu server running PHP?
- How can I configure a PHP application to use Redis with a specific timeout?
- How can I set a timeout for a Redis connection using PHP?
- How can I use Redis to rate limit requests in PHP?
See more codes...