Skip to content

Instantly share code, notes, and snippets.

@azazqadir
Created September 25, 2018 07:31
Show Gist options
  • Save azazqadir/ca8730448663a3f176806ecdcca37a34 to your computer and use it in GitHub Desktop.
Save azazqadir/ca8730448663a3f176806ecdcca37a34 to your computer and use it in GitHub Desktop.
Configuring Redis to be used as a PHP session Handler: (https://www.cloudways.com/blog/setup-redis-as-session-handler-php/ )
<?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;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment