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 list keys in Redis using PHP?
- How can I use the zscan command in PHP with Redis?
- How can I use Predis with a cluster in PHP?
- 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 can I install and configure Redis on an Ubuntu server running PHP?
- How can I configure TLS encryption for a connection between PHP and Redis?
- How can I use PHP and Redis to set a time-to-live (TTL) value?
- How can I execute a Redis query using PHP?
See more codes...