9951 explained code solutions for 126 technologies


predisHow can I install and configure PHP and Redis on a Windows system?


  1. Download and install the latest version of PHP for Windows and Redis for Windows.
  2. Edit the php.ini file and add the following line to enable the Redis extension: extension=php_redis.dll.
  3. Create a redis.conf file and add the following lines to configure Redis:
port 6379
bind 127.0.0.1
  1. Open a command prompt and start the Redis server with the redis-server command.
  2. Open a second command prompt and start the Redis client with the redis-cli command.
  3. Test the connection to the Redis server with the ping command. If successful, it should return PONG.
  4. 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

Edit this code on GitHub