Jump to content

Session expires in remote server.


void

Recommended Posts

Hi everyone,

 

I'll keep it short - i have two servers with different IPs for one site. The main has the www.domain.com address and another ones has remote.domain.com (both A-records). If a session is being created in the main site, it expires on another server, even though i have ".domain.com" set in my php configuration (cookie_domain). Is it possible to synchronize (?) the sessions on both servers? I wouldn't like to transfer sessids on url.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/105020-session-expires-in-remote-server/
Share on other sites

It is likely that the session cookie is being sent, have you checked by echoing it?

 

Assuming that the session cookie is being sent, your real problem is that a session only exists on any server because a session data file gets created that is tied to the session id. The session data file will be created on the server where the session is first established.

 

To get the session data file to be available to the second server, you would either need to store the session data files in a shared location, in a shared database, or actively write it to both servers every time it gets updated on either server.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.