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 can I configure TLS encryption for a connection between PHP and Redis?
- How do I install PHP, Redis, and XAMPP?
- 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 can I check the version of PHP and Redis I am using?
- How do I set the retry interval for a PHP application using Redis?
- How do I use HSCAN to retrieve data from Redis with PHP?
- How do I use the PHP Redis zrevrange command?
See more codes...