We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Distributed session on Libmemcached adapter does't work

Hello,

i want to create distributed session by libmemcached, so i have (on each domain):

$di->setShared('session', function () {
$session = new SessionAdapter(array(
    'servers' => array(
        array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 1),
    ),
    'client' => array(
        Memcached::OPT_HASH => Memcached::HASH_MD5,
        Memcached::OPT_PREFIX_KEY => 'prefix.',
    ),
   'lifetime' => 32400,
   'prefix' => 'users_'
));

$session->start();

return $session;
});

also php.ini was configured to store session memcached (session.start_handler), and i dont have any idea why it dont wwork...

explain: storing session in memcached server work fine, but sharing session between domains dont work////



7.6k

the anserw is: i cannot create one session to many domains or serwers by one logining.

There is only two prosible solution: after login i should:

1) jump to my second website (e.g. via changing php header) and login there by token (or oAuth) 2) make some loader and do the first step by ajax requests