Memcache session sharing under the same primary domain

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.