PHP Session with Memcached and AWS

I have an application running on Elastic Beanstalk and is just using ElastiCache to start memcached. However, I'm still trying to figure out how to use it to save a session. From what I read, I thought everything was right, but I'm not sure why it is not working.

My code is:

<?php
ini_set('session.save_handler', 'memcached');
ini_set('session.save_path', 'xxxxx.nrrxny.cfg.use1.cache.amazonaws.com:11211');
session_start(); 

$_SESSION['views'] = $_SESSION['views']+1;
echo "Pageviews = ". $_SESSION['views'];

echo "<h3>Show All Variables</h3>";
foreach ($_SESSION as $key=>$val)
echo $key." ".$val."<br/>";
?>
+3
source share

All Articles