Connect to redis from PHP

To connect to redis, first install php-redis

apt install php-redis

Now create a php file with following code

root@ip-10-0-0-31:/var/www/html# cat 2.php 
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# 

redis

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *