Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does PHP solve the problem of losing SESSION

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you PHP how to solve the problem of missing SESSION, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1.1 loss of SESSION1.1.1 phenomenon

After upgrading from PHP 5.5.9 to PHP 5.5.12, the subsequent page does not remember the status of successful login after the application performs the login operation.

1.1.2 reasons

After the tracking code, it is found that the status information has been written to the Session after the login is successful, but after the page is redirected to the home page, the Session is gone, causing the backend to think that it is accessed by an unlogged-in user.

Why is Session missing? Several methods are given on the Internet, but after careful analysis, this case is not applicable. Because of the same code, it is normal to run on other servers, only on the locally upgraded server, so it should be caused by the PHP upgrade.

Copy a PHP.INI file from another server and compare it with that of this machine, and find the following parameters:

Session.save_path = "D:/PHPDevEnv/PHP 5.5.9/temp"

The red part configuration is the crux of the problem. Originally using PHP 5.5.9, the directory name of PHP contains the version number, and then upgraded to PHP 5.5.12, considering that it is possible to upgrade PHP in the future, and the version number in the directory name is not conducive to subsequent upgrades, so the version number in the directory is removed, and a number of related configurations in the configuration file are modified at the same time, but there is no complete search for the string PHP 5.5.9, resulting in the above parameters not modified. So PHP cannot find the path when saving the Session.

1.1.3 Resolution

Change the above parameters to an actual path and restart the Apache server.

The above is all the contents of the article "how to solve the problem of missing SESSION by PHP". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report