How to share sessions data between Symfony controllers and classic stand alone php script where sessions are managed in memcache? How to share sessions data between Symfony controllers and classic stand alone php script where sessions are managed in memcache? symfony symfony

How to share sessions data between Symfony controllers and classic stand alone php script where sessions are managed in memcache?


You should check the Bridge a legacy Application with Symfony Sessionsbut overall you can configure it in the following way:

framework:  session:    storage_id: session.storage.php_bridge    handler_id: ~


I finally solved the problem.

In the parameters.yml file I put :

session_memcached_prefix : ''

instead of :

session_memcached_prefix : 'BPY_'

and the two envirennements can share sessions data.

In the Symfony controllers I still use

$request->getSession->get('key');$request->getSession->set('key', $value);

And in the stand-alone php script I use set and get data in this array :

$_SESSION['_sf2_attributes']

So

$_SESSION['_sf2_attributes']['key'] = $value