How to check sessions

#Add this script to the DocRoot and browse to it. The session_id shouldn’t change if it is preserving sessions

< ?php
// DONT FORGET TO CHECK FOR VARNISH RUINING EVERYTHING
ini_set( ‘display_errors’, 1);
session_start();

echo ‘HOSTNAME: ‘ . gethostname() . ‘ ‘;
echo ‘SESSION: ‘ . session_id() . ‘ ‘;

if (isset($_SESSION[‘counter’])) {
$_SESSION[‘counter’]++;
} else {
$_SESSION[‘counter’] = 1;
}

echo ‘
DUMP SESSION:
‘;
echo ‘

';
print_r($_SESSION);
echo '

‘;

phpinfo();
?>

About vicki

Welcome to the Sovereign Republic of Vickistan. I am the President here. Lucky me! No taxes or laws yet. Lucky you!
This entry was posted in Linux. Bookmark the permalink.