CI4 - session not persisting |
I just uploaded a test site on an ubuntu server and it seems that session data is not being persistent.
e.g. mydomain/home/test/?ds=set&key=name&val=xyz would print the $ss with the value of key and val. However, I back to mydomain /home/test without ds=set querystring - it should print the session value set in the previous request but its empty. Code: $ds = $this->request->getGet('ds'); I cleared all files from writable/session folder and if I refresh site page it creates a session file in there. I also noticed that every page refresh creates a new session file in this folder. I am not sure what's going wrong here. Is this a permissions issue? The session file (in writable/session folder) has permission 600 i.e. group has read/write. Is that causing an issue? I am not sure. How do I fix it?
I have now tried Database option too but still no luck. Locally, on Windows machine, both files and database work without any issues.
I am pretty sure it's something to do with cookies settings but most of the config is what you have there by default. I haven't made any made any modifications. Also, I have got the latest code of CI4. What's goig wrong with cookies?
do you use the same web server config on host/remote ? you should get the "almost" same result on any host -> so pls compare your configs and look for some uncommon errors/messages in your web server log.
sry cant help you much as long as we cant reproduce the problem. (10-22-2018, 06:16 AM)puschie Wrote: do you use the same web server config on host/remote ? you should get the "almost" same result on any host -> so pls compare your configs and look for some uncommon errors/messages in your web server log. Yes I understand. Everything was same except on the Ubuntu server I had php fpm. I changed that to mod_php and it seemed to have fix the issue for me. It was a very odd issue really.
I start the sessions in a Base controller that all the other controllers extend.
In the constructor I have the sessions like so. PHP Code: /** I can then use the $__SESSION global any place in the app even views. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |