PHP Storage Session to Memcache

Source: Internet
Author: User
PHP Storage Session to Memcache
Because I want to cross the top-level domain, I want to save the session in Memcache,
The following settings are made:
Ini_set ("Session.save_handler", "memcache");
Ini_set ("Session.save_path", "tcp://192.168.0.77:11200");

To error: A session is active. You cannot change the session module ' s INI settings.

If you set this up again: Session.auto_start =0
You can normally save the session in Memcache.

However, at this point, every time the page is refreshed, the SessionID value changes so that it does not get the previously saved value.

Set the value of Session.auto_start to 1, the value of each refresh page SessionID will remain the same, but the value is not stored.

May I ask how to resolve this contradiction?


------Solution--------------------
Session_Start ();
To be in Ini_set ("Sessio ... After execution

You change the session settings at the script level, and Session.auto_start = 1 o'clock, PHP implicitly calls Session_Start () before the script executes.
That's not going to fit your needs, of course.
------Solution--------------------
Upstairs positive solution, can use encrypted cookies to achieve your cross-top domain name, a different idea to try.
------Solution--------------------
Reference Ucenter
------Solution--------------------
Pass the SessionID value, use the SESSION_ID function to specify the SessionID value

  • 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.