Php - 更改应用程序根目录并保留会话

I have 2 versions of a website.

/site-v1
/site-v2

I have 1 domaine

site.com

I want to set in production site-v2 (that is going to replace site-v1), the session structure is exactly the same as the v1. Then i dont want that the people browsing the site during the prod lose their session. The file structure is too much different for just replacing the files, i need to change the root directory.

In the apache virtual host, When site.com root directory changes from /site-v1 to /site-v2/public. Then the php session doesnt exist anymore. When i come back to /site-v1, then the session still not exists.

Do you know how to keep the session when i'm using the same domain while changing the root directory ?

Using apache 2 and php 5.3. I checked session_save_path and both version uses /var/lib/php5


Edit

I browse the version 1 On the server I change the root directory :

a2ensite version2 && a2dissite version1 && service apache2 restart

I browser the version 2 (the session was replaced)

On the server I change the root directory :

a2ensite version1 && a2dissite version2 && service apache2 restart

The session was erased again (even the one from the first version 1 browsing)

The two virtualhost are the same (except for the root directory)

If the session related php settings are the same. (session_save_path, session_handler,... ) And the domain address also won't change.

Then you don't need to do anything. The browser will send the same cookie and the webserver will find the related session content in the same place (directory.)