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.inifile and add the following line to enable the Redis extension:extension=php_redis.dll. - Create a
redis.conffile 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-servercommand. - Open a second command prompt and start the Redis client with the
redis-clicommand. - Test the connection to the Redis server with the
pingcommand. 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 PHP and Redis to retrieve data from a sorted set using ZRANGEBYSCORE?
- How can I troubleshoot a "PHP Redis went away" error?
- How do I install PHP, Redis, and XAMPP?
- How do I install and configure a PHP Redis DLL on a Windows machine?
- How can I use PHP and Redis to retrieve a range of values from a sorted set?
- How do I install PHP Redis on Ubuntu 20.04?
- How can I use PHP to increment values in Redis using ZINCRBY?
- How do I use the PHP Redis zrevrange command?
- How do I use yum to install php-redis?
- How can I use the zscan command in PHP with Redis?
See more codes...