RE: [PHP] Session in two servers
| From: | Kim Madsen | Date: | Fri, 01 Apr 2005 13:09:06 +0000 |
| Subject: | RE: [PHP] Session in two servers | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-212030@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Srinadh Sannidhanam [mailto:ssnadh@gmail.com]
> Sent: Friday, April 01, 2005 2:59 PM
> Hi,
> I am using sessions in my web application which is installed in two
> pawns. So the request is randomly picked by one of the two servers. I
> am using files in php session but not database. My problem is, if the
> first request go to one server and the session is created there, then
> for the following request going to other server will not have session.
> How can we manage the session simultaniously in two servers? Please
> help me in this regard.
Do a "print phpinfo()", this will most likely tell You that session.save_path is set to
/tmp, that´s default. What You need is to mount the HD of server1 onto server2 and set this as the
session.save_path. Have a look at for instance nfs mount, if You´re running linux.
Remember to have a clean-up script running, if You choose another dir than /tmp or the session files
will never be deleted.
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper