Yes, Ubuntu Server with PHP7 supports Redis. You can install the necessary packages and configure PHP to work with Redis by following these steps:
Update the package list on your Ubuntu server:
sudo apt update
Install the Redis server:
sudo apt install redis-server
Install the PHP Redis extension:
sudo apt install php-redis
Restart the PHP service to apply the changes:
sudo systemctl restart php7.4-fpm
Test if Redis is working with PHP by creating a PHP file, for example, test_redis.php
, and add the following code:
<?php
$redis = new Redis();
$redis->connect('localhost', 6379);
$redis->set('key', 'value');
echo $redis->get('key');
?>
Save the file and access it through a web browser. If everything is properly set up, you should see the value value
displayed on the page.
That's it! You have successfully installed Redis and configured PHP to work with it on your Ubuntu Server with PHP7.