Sharing session with no CI app |
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!
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. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
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!
Best bet would be to store the information in the database. Sharing session data would be a security risk.
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 |