predisHow can I install and configure PHP and Redis on a Windows system?
- Download and install the latest version of PHP for Windows and Redis for Windows.
- Edit the
php.ini
file and add the following line to enable the Redis extension:extension=php_redis.dll
. - Create a
redis.conf
file and add the following lines to configure Redis:
port 6379
bind 127.0.0.1
- Open a command prompt and start the Redis server with the
redis-server
command. - Open a second command prompt and start the Redis client with the
redis-cli
command. - Test the connection to the Redis server with the
ping
command. If successful, it should returnPONG
. - Test the PHP Redis extension by running the following code:
<?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 can I use PHP and Redis to retrieve data from a sorted set using ZRANGEBYSCORE?
- How can I use the PHP Redis HGET command?
- How do I use the PHP Redis zrevrange command?
- How can I use PHP and Redis to get a reverse range of scores?
- How can I use Redis with the Yii PHP framework?
- How can I use Predis with a cluster in PHP?
- How do I install and configure a PHP Redis DLL on a Windows machine?
- How do I use yum to install php-redis?
See more codes...