Home > Article > Backend Development > $SESSION is lost after PHP upgrade_PHP tutorial
It is necessary to upgrade the PHP version of an internal system in the production environment from 5.3 to 5.4.16
After it was generated, I found that I couldn’t log in. I interrupted all the way and found that when the two pages on the server jumped, I couldn’t get $SESSION
Sadly, I went online to look for solutions, and found various opinions,
First check the browser cookie, the cookie is available, and the sessionID can be obtained normally
Looking at the code again, the code is written very normally, with session_start at the beginning and $SESSION[XXX] = XXXX in the middle, all normal
When I am confused and about to go crazy
I remembered, where does PHP save the session?
Tomcat can choose to serialize it in the database, write it to a local file, or simply save it in memory
PHP originally saved it in a txt file by default, and the saved path is session.save_path
in PHP.ini
Amitabha, after upgrading the PHP, the system handed the ownership of session.save_path to root, not the user I currently run PHP
PHP does not have permission to write the session to this path, and of course it will be lost.
FFFFKK Dog Day PHP !!!!