Skip to content

Instantly share code, notes, and snippets.

@unix1 unix1/test-peb-session.php
Last active Dec 18, 2015

What would you like to do?
Sample page to illustrate and test PHP session storage in Erlang Mnesia via mypeb PHP extension and kvstore application. Full instructions are here:
<h1>Test Peb Page</h1>
<p>This page starts a session and keeps a counter in a session variable.</p>
<p>It uses kvstore application to store PHP sessions in Erlang Mnesia.</p>
<div><a href="test-peb-session.php">Reload this page</a> to increment the counter.</div>
interface SessionHandlerInterface {}
$s = new \lib360\net\http\session\PebKvStore('kv1@localhost', 'your-erlang-cookie-here');
array($s, 'open'),
array($s, 'close'),
array($s, 'read'),
array($s, 'write'),
array($s, 'destroy'),
array($s, 'gc')
isset($_SESSION['counter']) ? ++$_SESSION['counter'] : $_SESSION['counter'] = 0;
<p>Session array</p>
<?php foreach ($_SESSION as $k => $v) {?>
<tr><td><?php echo $k; ?></td><td><?php echo $v; ?></td></tr>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.