ZF2 session

for zend/session I use this:

$populate = array(‘foo’ => ‘bar’);
$config = new StandardConfig();
‘save_path’ => ‘/home/[username]/public_html/blah’,
‘use_cookies’ => true,
‘cookie_lifetime’ => 3600,
‘name’ => ‘zf2’,
‘cookie_httponly’ => true,
‘gc_maxlifetime’ => 3600,

$config = new SessionConfig();
‘hash_function’ => ‘sha1’,
‘use_trans_sid’ => true,

$manager = new SessionManager($config);
$manager->setStorage(new SessionArrayStorage($populate));
$manager->getValidatorChain()->attach(‘session.validate’, array(new HttpUserAgent(), ‘isValid’));
//$manager->getValidatorChain()->attach(‘session.validate’, array(new RemoteAddr(), ‘isValid’));

However I don’t get an error, and I see I have sessions by print_r($_SESSION) but it seems that $config this is not working for me. e.g. I don’t see a name zf2 as specified above but if I change the path to a folder that does not exist I get an error but if exists I see nothing in folder. I don’t see any cookie too. when changing to another $config and set hash_function to blah I get an error as expected, and sha1 and md4 are fine. so I think it is reading my $config, so why I don’t see a cookie name zf2 or no file in that path? plz advice


So StandardConfig was not working for me because my php.ini override it?
Then how can I use the set sessions? and where to use this validators?
$manager->getValidatorChain()->attach(‘session.validate’, array(new HttpUserAgent(), ‘isValid’));
$manager->getValidatorChain()->attach(‘session.validate’, array(new RemoteAddr(), ‘isValid’));
I should add these lines only once when it is setting up the sessions? then when it prevent/fail if a session hijack is happening?