Re: PHP sessions on different hosts - *urgent*
| From: | Chris Adams | Date: | Wed, 12 Jul 2000 15:33:20 +0000 |
| Subject: | Re: PHP sessions on different hosts - *urgent* | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6158@lists.php.net to get a copy of this message | ||
> > Is there a way to make both servers go search in the same place for
> > the session information? (both servers are networked together and
> > both can access each others resources).
>
> I've never actually tried this, but I suppose you could change the
> default session cache directory in php.ini to something other than
> /tmp and then share that directory between the two servers (via NFS,
> for example).
>
> Another option is to implement your own session handler and store the
> session information in a common database or similar filestore. That
> would be the longer but more correct approach to solve your problem.
I'd recommend the last approach as it avoids all sorts of potential file
locking issues, will probably have better performance, and there are several
off-the-shelf database handlers so the setup time doesn't need to be longer
than the morning coffee break.
If you want a MySQL handler, mine is at
http://gateway.digitaria.com/~chris/php/mysql_session_handler/.