Silex sessions not saving data?


New Member
After finding this question I got my Silex sessions to at least get an ID assigned, but I'm not seeing the session data get saved across different page views:\[code\]require(__DIR__.'/vendor/autoload.php'); // Composer autoload$app = new Silex\Application();$app['debug'] = true;$app['db'] = $app->share(function() { // Database connector as a service return new PDO('mysql:host=localhost;dbname=myawesome_db', 'user', 'paswd');});$app['session.db_options'] = array( 'db_table' => 'php_sessions', 'db_id_col' => 'session_id', 'db_data_col' => 'session_value', 'db_time_col' => 'session_time',);$app[''] = $app->share(function () use ($app) { return new Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler( $app['db'], $app['session.db_options'], $app[''] );});$app[''] = $app->share(function() use ($app) { return new Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage( $app[''], $app[''] );});$app->register(new Silex\Provider\SessionServiceProvider()); // Start session management$app['session']->start();$app->get('/session-set', function() use ($app) { $app['session']->set('foobar', 'test'); $app['session']->save(); $out = "User session is: ".$app['session']->getId()."<br />\n"; $out .= "Session variable is: ".var_export($app['session']->get('foobar'), true)."<br />\n"; return $out;});$app->get('/session-get', function() use ($app) { $out = "User session is: ".$app['session']->getId()."<br />\n"; $out .= "Session variable is: ".var_export($app['session']->get('foobar'), true)."<br />\n"; return $out;});$app->run(); // Off into the sunset\[/code\]The \[code\]/session-set\[/code\] page shows a value for the \[code\]foobar\[/code\] session variable, but the \[code\]/session-get\[/code\] page does not. Anyone able to help me figure out why?