0
votes

My requirements of Zend\Session are pretty straightforward and my first access to it is with the following line of code:

$this->session = new Container('MySession');

My question is, where (by default) is this stored? In the case of ZF1, it was very simple: there was a file for each session under /data/session. The file name was a cookie id and you could 'cat' the file to see what was going on.

What's the buzz with ZF2? I've had a look through Zend\Session\Config files but I'm still in the dark.

3

3 Answers

2
votes

When using just $this->session = new Container('MySession'); then your sessions will by default be saved wherever your php.ini is set to save them. Normal installations set them to be saved in the /tmp folder.

So you have two options:

1) Change the session.save_path in your php.ini to the new location.

2) You can do something like this:

$this->session = new SessionConfig();
$this->session->setOptions(array(
    'save_path' => __DIR__ . '/data/session'
));
2
votes

Session data location is not depends on framework. It is in php.ini, option session.save_path

0
votes

Are you sure you didnt find anything under Zend\Session\Config\StandardConfig and Zend\Session\Config\SessionConfig ?

Also, take a look at Zend\Session\Storage

Then you can configure some stuff as you can read here:

http://framework.zend.com/manual/2.1/en/modules/zend.session.config.html