Page 1 of 1
Session fault tolerence
Posted: Wed Oct 06, 2004 2:06 am
by mike_b2
I am trying to write my code so my sessions are able to run across two or more servers.
I want to do this using the session ID sotred in a cookie not using URL rewriting.
With that said can someone point me in the direction of a howto, code examples, and / or configuration requirements to do this.
I am using a load balancing router in fron tof the servers, so to the outside world this will look like the same ip address / hostname.
Thanks,
Mike

Posted: Wed Oct 06, 2004 2:13 am
by feyd
[php_man]session_start[/php_man]() / [php_man]setcookie[/php_man]()
Is there a shared database between these 2 servers? If so, you can pass the session data through that, and just need the session id, which can then be passed in any standard fashion.
Posted: Wed Oct 06, 2004 2:16 am
by mike_b2
Thanks for the reply.
Yes, there is a shared database, however I am a newbie to PHP and while looking at the session doc saw mention they could be shared but did not see it as out of the box explicitly. e.g. Do I need to be careful of duplicate session ID's., is there any exclusivity issues with the table etc.
Posted: Wed Oct 06, 2004 2:47 am
by feyd
the probability that the machines generate the same id is quite slim, but if you are concerned about it, you could (potentially) select a
UUID from MySQL (4.1.2 or later), or create your own somewhat synchronized way through some interserver communication.
As for exclusivity to the table, probably not as well, but that depends on the type of table/database you are using.
Posted: Wed Oct 06, 2004 7:46 am
by djot
-
How about security, passing sessions or ids?
Btw., 1 login for 2 servers is called "single sign on".
djot
-
Thanks feyd that is what I was looking for<eom>
Posted: Wed Oct 06, 2004 8:49 am
by mike_b2
Thanks feyd that is what I was looking for.
Mike