<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$redis = new Redis();

try {
    $redis->connect('127.0.0.1', 6379);

    // Uncomment if your Redis requires password
    // $redis->auth('your_redis_password');

    $redis->set('test_key', 'Hello Redis!');
    $value = $redis->get('test_key');

    if ($value === 'Hello Redis!') {
        echo "Redis is working correctly! Retrieved value: " . $value;
    } else {
        echo "Redis connection successful, unexpected value: " . var_export($value, true);
    }
} catch (Exception $e) {
    echo "Could not connect to Redis: ", $e->getMessage();
}
?>