This configuration is suitable for session sharing with multiple servers with the same primary domain name .
For example: www.lee.com, bbs.lee.com (multiple subdomains).
Configure session Save in Memcache:
Ini_set ("Session.save_handler", "memcache");
Ini_set ("Session.save_path", "tcp://127.0.0.1:11211");
* * Multiple Memcache servers are separated by commas:
**ini_set ("Session.save_path", "tcp://127.0.0.1:11211,tcp://127.0.0.1:11211");
Ini_set ("Session.cookie_domain", ". lee.com"); //Specify the domain name that the cookie is saved in, the same domain name is consistent with the session_id saved under the browser.
If the Memcache client is an libmemcached-based memcached extension, it is configured as:
Ini_set ("Session.save_handler", "memcached");
Ini_set ("Session.save_path", "127.0.0.1:11211");
Ini_set ("Session.cookie_domain", ". lee.com");
Principle: The sessions under different servers are stored in memcache and have the same session_id.
Note:
* * Local virtual machine test:
Need to configure 192.168.1.20 www.lee.com bbs.lee.com
* * The subdomain cannot be accessed until bbs.lee.com is specified.
Memcache session sharing under the same primary domain