Wamp PHP cannot save the session.

Source: Internet
Author: User

Because it is under Windows IIS PHP Environment, so in many cases can not be set as simple as lamp. I also encountered a lot of situations where the session could not be saved (under Wamp) for work reasons. The following is a summary of the trust information, only for reference learning.

1, php.ini setup issues, such cases need to be set

Session_auto_start = On//This is the auto-open session.

Enter Phpinfo in the PHP document to see if the session is correctly opened.

2, there is a problem saving the session folder

First look at the existence of Session_save_path in php.ini, and is not commented out, if there is a general widnows in the default is C:\Windows\Tmp, this directory by default is not allowed to read by other users.

Solution Solutions

1The Settings folder is read-writable by everyone, so while it resolves the problem, it creates a security issue because it is a cross-directory read of other information, such as the registry, under Windows.

2. Reset Session_save_path, set to restart IIS after setting to see if it succeeds if unsuccessful, set two, because in php.ini in order to be compatible with the previous version there are two one is commented out is4.0 above one is more than 5.0. After the setting is complete, set the directory for everyone to read the write, and then inherit, the others do not check, so that the security of the storage directory and system data security.

3. It is related to the program code.

When you see the settings in the directory where the session is generated, but all of the empty files are 0kb, it is necessary to check the code if there is a problem.


1If Session_auto is turned on, please turn it off. Then write the session_start on top of the page

2If the first option is not valid, it is recommended to precede the session_start with'@'symbols, write pages and read pages are added.

4. Other issues,

If the above reasons can not be processed, please check whether the PHP document is currently loaded PHP document, Wamp loaded php.ini in Apache, about checking the current PHP environment loading php.ini, please pay attention to the following article.

Reprint Please famous source thank you.

Wamp PHP cannot save the session.

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.