新的Lamp linux服务器上的PHP会话

Short introduction : i have one server that is running a LAMP stack with a login form and 2 different servers with other IP's hosted in the same data center so i can setup Private networking between the servers .

To Accomplish :

Network Diagram

User 1 logs in on webserver 1 that starts a php session on Webserver 2 without giving access to Webserver 3

User 2 logs in on webserver 1 that starts a php session on Webserver 3 without giving access to Webserver 2

i have been looking into the situation so i think it can be done with memcache ? But i'm not sure on that any help on how this setup could be configured would be greatly appreciated .

When you start using multiple application servers they should be stateless. Eg. No database, no sessions, no caches. All of these resources should be moved to their own servers that can be accessed by any part of the system that needs them.

Your choice of session management store very much depends on your needs. If you have very low traffic you can get away with storing sessions in the database, otherwise look into something like Redis for high performance storage.

For sure You'll have to setup a server where You can store session information between webservers. Memcache is a very good choice. Another can be database server like MySQL, but this will be a poor performance solution.

You can configure PHP to store session information in memcache only by installing memcache extension and modifying .ini files. This is pretty easy.

More difficult task will be passing information about session ID between servers, because session started on WS1 must be restored on WS2 but not on WS3.

To help You with this, please describe more how the login and accessing servers flow look like.