CodeIgniter Forums
How can I resume the session? - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: How can I resume the session? (/showthread.php?tid=74694)

How can I resume the session? - Navindex - 10-26-2019

I'm using session data to save and restore multi-page form data in CI4 (rc3). PHP version is 7.2.24.

It works very well when I use the conventional PHP-way with $_SESSION and session_start().
However, when I try to do the same with CI4, it creates a new session instead of resuming the existing one.

The environment settings are:

app.sessionDriver             = 'CodeIgniter\Session\Handlers\FileHandler'
app.sessionCookieName         = 'my_session_cookie_'
app.sessionExpiration         = 7200
app.sessionMatchIP            = false
app.sessionTimeToUpdate       = 300
app.sessionRegenerateDestroy  = false

This happens every time when I initialize the session ( $session = session(); ) on a new page. I would expect it resumes the existing session, however, a new cookie is created.


These files contain session data of a single page only.

Is this a bug or I'm missing something here? When I switch back to PHP's session_start(), it resumes the session correctly.