Home  >  Article  >  Backend Development  >  The painful experience of losing Apache PHP SESSION under Windows, apachesession_PHP tutorial

The painful experience of losing Apache PHP SESSION under Windows, apachesession_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:58:31783browse

The painful experience of losing Apache PHP SESSION under Windows, apachesession

Today’s work is to migrate a PHP site to a new server.

Create a Windows Server 2008 virtual machine, and stop the net stop http service on it (to avoid competing for port 80), install and configure Apache PHP, migrate the site to the new server, and open the site normally, Apache PHP It was running normally, connecting to MySql Server was normal, and everything was fine. I was thinking of completing the work in half an hour, but then the nightmare began.

This site uses single sign-on, and the login process includes JavaScript asynchronous operations, including SOAP calls to Web Services. After logging in, it jumped directly back to the login page without any error message. We considered the following possibilities:

1. Is the account abnormal? Tested on other systems, the account status is normal.

2. Did the JavaScript asynchronous operation fail? Use IE developer tools to track the Javascript return value, and the return value is normal.

3. Did the Web Service call fail? Use Fiddler to track the return value of the Web Service, indicating that the verification has been successful and the local login has been completed.

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

1. JavaScript asynchronous operation to set SESSION failed. Is it because the SESSION ID of synchronous access and asynchronous access are different? This has only happened with asynchronous calls in Flash, will it also happen with JavaScript? The SESSION ID value of output synchronous access and asynchronous access is the same.

2. Create 2 PHP test pages, set SESSION in one page, but cannot read it in the other page. Check the php.ini related settings, it seems normal. Check the session.save_path = "C:/php/tmp" path, but there are no SESSION related files, and the setting does not even include the tmp directory.

The ending is ridiculous. Without the tmp directory, PHP cannot write the SESSION file, and naturally the SESSION is lost. Why is there no tmp directory? Because it is not included in the installation package...my 3 hours.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/978185.htmlTechArticleThe painful experience of losing Apache PHP SESSION under Windows, apachesession Today’s work is to migrate a PHP site to a new server. Create a Windows Server 2008 virtual machine and stop it...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn