Connect to redis from PHP
To connect to redis, first install php-redis
1 |
apt install php-redis |
Now create a php file with following code
1 2 3 4 5 6 7 8 9 10 |
root@ip-10-0-0-31:/var/www/html# cat 2.php <?php $redis = new Redis(); $redis->connect('news24redis.cylrbg.serverok.use1.cache.amazonaws.com', 6379); echo "Connection to server sucessfully"; echo "Server is running: ".$redis->ping(); root@ip-10-0-0-31:/var/www/html# |