CodeIgniter Forums
session_start() error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: session_start() error (/thread-74497.html)



session_start() error - aparedesv - 10-02-2019

Hi,

Huh

I want initialize a session library in controller follow the instructions of the manual

$session = \Config\Services:Confusedession($config);

but, I get a error

SYSTEMPATH/Session/Session.php at line 1001


RE: session_start() error - aparedesv - 10-02-2019

i resolve with .env file:

app.sessionSavePath = 'session'


RE: session_start() error - Digital_Wolf - 10-02-2019

Here is the documentation for CI3:
https://codeigniter.com/userguide3/libraries/sessions.html
And this for CI4:
https://codeigniter4.github.io/userguide/libraries/sessions.html
Do exactly as it is described and you will succeed !
And could not would you straight for the himself code where you're trying connect to sessions and logs mistakes from directory /writable/logs/
this is necessary so that we can give a more accurate answer to your question !


RE: session_start() error - aparedesv - 10-02-2019

(10-02-2019, 05:05 AM)Digital_Wolf Wrote: Here is the documentation for CI3:
https://codeigniter.com/userguide3/libraries/sessions.html
And this for CI4:
https://codeigniter4.github.io/userguide/libraries/sessions.html
Do exactly as it is described and you will succeed !
And could not would you straight for the himself code where you're trying connect to sessions and logs mistakes from directory /writable/logs/
this is necessary so that we can give a more accurate answer to your question !

Ok,

I start a new CI4 project and uncomment last line (// $this->session = \Config\Services:Confusedession()Wink and I get the error.

I solved it with .env file: app.sessionSavePath = 'session'

thank's.


RE: session_start() error - kilishan - 10-03-2019

Yes, most of the session drivers require sessionSavePath to be set. This can be done in app/Config/App.php itself, or through the .env file like you've seen.


RE: session_start() error - aparedesv - 10-07-2019

Hi,

I solve the load library, but when I try to set a session with ($this->session-set('', '')Wink I get a new error
Invalid serialization data for DateTime object#0 [internal function]: DateTime->__wakeup().

Some idea? it's possible to the problem are in the apache config for php 7.3?

thank's


RE: session_start() error - Jan Zelenka - 07-08-2020

This might be perceived as a dig, sorry for that but I ran into exactly the same issue.
This time with PHP 7.2.1.

I've read on some dev site there was a PHP bug causing this around version 5.3 or so. Is it possible the PHP itself is at fault?