Session is in memcache. When session_start () is called again, no data is read.

Source: Internet
Author: User
Session_set_save_handler is used to store the session in memcache and then restart the session. The data is not read. When the session contains a file, you can read the data when you call session_start () again. But it is not read in memcache (of course, from... session_set_save_handler is used to store the session in memcache
Then I want to restart the session and find that the data is not read.
When the session contains a file, you can read the data when you call session_start () again.
But it is not read in memcache (of course it can be obtained from memcache)

Question 1: Can I read session data in memcache by reusing existing sessions?
Question 2: How does session_start () load data when reusing existing sessions?

Reply content:

Session_set_save_handler is used to store the session in memcache.
Then I want to restart the session and find that the data is not read.
When the session contains a file, you can read the data when you call session_start () again.
But it is not read in memcache (of course it can be obtained from memcache)

Question 1: Can I read session data in memcache by reusing existing sessions?
Question 2: How does session_start () load data when reusing existing sessions?

Session_start () creates a new session or reuse an existing session. If the session ID is submitted by using the GET or POST method or using the cookie, the existing session will be reused.
Http://php.net/manual/zh/function.session-start.php

The simplest method should be that php. ini can be set directly.

Method I: global settings in php. ini

session.save_handler = memcachesession.save_path = "tcp://127.0.0.1:11211"

Method II:. htaccess in a directory:

php_value session.save_handler "memcache"php_value session.save_path  "tcp://127.0.0.1:11211"

Method III: or in an application:

ini_set("session.save_handler", "memcache");ini_set("session.save_path", "tcp://127.0.0.1:11211");

I guess there is a problem with the code writing.

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.