Sharing session with no CI app - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Sharing session with no CI app (/showthread.php?tid=80891) |
Sharing session with no CI app - gurthang75 - 12-30-2021 Hi guys! I´m having a hard time trying to share the same session between a native php app and a ci app the situation is the next: We are currently trying to migrate an entire app to CI4 the native php app produce a session and at some time make a post to CI app when i land to the CI app (works great) the session does not pass to CI im playing with the session files cause i think it search for the same ci_session name i already change the both sessions names to try to mach eachother (with no luck) the session file that the old app is creating, got the name: sess_d5agcbecpo9jhq8951g59g67na meanwhile when the app lands at ci this produce this file: mhp_session2ag2pf95sto44ukte3huptrt1gnap3k5 (mhp_session is my cookie_name in .env file) Session are created anew. Tip: when i click back in explorer it produce another session file with this name: sess_d5agcbecpo9jhq8951g59g67na (with no data and crash the sistem) Another Tip in ci app im using session service from CI4 in my BaseController Code: $this->session = \Config\Services::session(); Thanks in advance! RE: Sharing session with no CI app - ikesela - 12-30-2021 check your CI session driver, default is FileHandler (store in writable folder) RE: Sharing session with no CI app - InsiteFX - 12-31-2021 I have my BaseController like this for checking session. PHP Code: <?php Make sure you do the session check to see if it is loaded first. RE: Sharing session with no CI app - gurthang75 - 01-03-2022 Hi boyos! first of all thks for the response! now... i tried the session check first in my base controller -> didnt work... its still creating a new session file in writable/session folder i change my .env to try and match the name of my session with the other app like this: Code: app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler' the result is: a session file named sess_aj2fri8h0ucnsfu5shkjhmmtaj -> my app session sess7mo31q37chk4ghtbkjl81i8ruhlg2id7 my ci session if i putt the sessionCookieName = 'sess_' generates a session with the name "sess_" diferente to the other app named "sess", gives me two session diferents names.... Im using filehnadler, the two sessions are stored in writable/session folder Salute! RE: Sharing session with no CI app - InsiteFX - 01-04-2022 Best bet would be to store the information in the database. Sharing session data would be a security risk. |