简体   繁体   中英

Is it possible to share session between different PHP versions?

I am starting an old app refactoring, I will rebuild some functionality from spaghetti code to MVC (Symfony). Plan was I will set up new IIS app, using subdomain. Now, old app is running PHP 5.3 which can't be upgraded. New app will be running on PHP 5.6. Only thing I need to carry is authentication. I can have login script either on old or new app. I tried setting session cookie params but I can't get it working.

Is it possible at all or do I have to use database? If it is not possible, can that be achieved in Apache?

Edit:

What I'm to do is:

session.cookie_domain = ".dev" 

In both php.ini. Then I start the session in one, set a session variable.

session_start();
$_SESSION['test'] = 123;

Then in the second app (php 5.6) I'm trying to read it:

session_start();
var_dump($_SESSION);

But it's empty.

Apparently setting session cookie domains does not work for top level domains (TLD), like .dev

Changed my code to:

ini_set('session.cookie_domain', '.local.dev');

and now I am able to set session variables on .local.dev website and read them in new.local.dev

Both apps are physically in separate folders, operate from two IIS entries and using different PHP versions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM