In Windows, the entire process of solving the loss of Apache + PHP sessions is recorded, and apache is recorded.

Source: Internet
Author: User

In Windows, the entire process of solving the loss of Apache + PHP sessions is recorded, and apache is recorded.

Today's job is to migrate a PHP site to the new server.

Create a Windows Server 2008 Virtual Machine and stop the net stop http service on it (avoid competing for port 80), install and configure Apache + PHP, migrate the site to the new Server, and open the site normally, apache + PHP runs normally and connects to the MySql Server normally. Everything is fine. I thought about the work completed in half an hour, and then the nightmare started.

This site uses single sign-on. The logon process includes JavaScript asynchronous operations and SOAP calls to Web Service. Login directly jumps back to the login page without any error prompts. Consider the following possibilities:

1. Is the account abnormal? In other system tests, the account status is normal.

2. Why does JavaScript Asynchronous Operation Fail? Use the IE developer tool to track the Javascript return values. The returned values are normal.

3. Why does the Web Service call fail? Tracking the returned value of Web Service with Fiddler indicates that the verification has been successful and local logon has been completed.

After repeated tracing and debugging, I began to suspect that the site SESSION was lost:

1. failed to set the SESSION for Asynchronous JavaScript operations. Is it because the session id for Synchronous access and asynchronous access is different? This occurs only when asynchronous calls are made in Flash, and does JavaScript work? The session id values of the output synchronous access and asynchronous access are the same.

2. Create two PHP test pages, set the SESSION on one page, but cannot read the SESSION on the other page. Check php. ini-related settings, it seems to be normal, view the session. save_path = "C:/php/tmp" path, but there is no SESSION-related file, and no tmp directory is set.

The final result is ridiculous. Without the tmp directory, PHP cannot write SESSION files, and the SESSION is lost. Why is there no tmp directory because the installation package does not contain ...... My 3 hours.

The above is all the content of this article, hoping to help you learn php.

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.