<?php
ini_set('session.save_handler', 'redis');
ini_set('session.save_path', "tcp://localhost:6379");
//echo ini_get('session.save_path');
session_start();
$count = isset($_SESSION['count']) ? $_SESSION['count'] : 1;
echo $count;
$_SESSION['count'] = ++$count;
?>
Add the above code to your index.php file to enable Redis as a PHP session handler ( https://www.cloudways.com/blog/setup-redis-as-session-handler-php/ ) in your app. For this, you must install and configure Redis server first.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.