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('', 6379); 

echo "Connection to server sucessfully"; 

echo "Server is running: ".$redis->ping(); 


Need help with Linux Server or WordPress? We can help!

Leave a Reply

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