I have 2 codeigniter installs running on the same server.
the first app is :
localhost/aa/index.php
second app is :
localhost/aa/invoice/index.php
If you install the code on the same Server using the same encryption key, By default, both installation will share session. Actually, I discovered when I copied a codeigniter installation for another client but on the same server. I thought it was a bug as I was worried.
$config['sess_cookie_name'] = 'myvalue';
In config.php file you can set the same value on both CI Apps., with 'file' Session Drivers
CI_Session Object
( [userdata] => Array ( [__ci_last_regenerate] => 1490351129 [Level] => 1 [User] => 103 [Fullname] => Ruben Caldera )
[_driver:protected] => files
[_config:protected] => Array
(
[cookie_lifetime] => 600
[cookie_name] => MyHiddenValue
[cookie_path] => /
[cookie_domain] =>
[cookie_secure] =>
[expiration] => 600
[match_ip] =>
[save_path] => /tmp
)
)
$config['encryption_key'] = 'epitome';
The encryption_key
configuration name will be the same for both the application folders.
Path to change the encryption_key
in codeigniter is application/config/config.php
Line number 228.
If I may .... I have noted that those design problems which are not practical and goes against the normal convention shall provided a basis for long and deep rooted problems.... You should ask your self it is really necessary / advisable to share session data between 2 different version of a framework when we know they are 2 different version for the reason that they do things differently... I can only say that no matter what you do.. this design flaw shall make your architecture fragile and sooner or later you will have to dump it.
Plz let me know if later you find out otherwise..
Codeigniter for some reason rolls its own session implementation rather than native PHP sessions.
http://codeigniter.com/user_guide/libraries/sessions.html
You get a choice of using:
Obviously you need to make sure your session identifier is configured correctly so both apps can read from the same session data. If using the database implementation, you need to make sure both apps can access the same DB.
To add to the complexity, if you choose to encrypt sessions, the salt used by the encryption class will also need to be the same in both apps, so either one is able to decrypt the shared session data.
If you move the code to the same server ,both the sessions will start to share by default.