Session variables not working php

后端 未结 10 1355
别跟我提以往
别跟我提以往 2020-11-22 03:12

Here are the code of my login page where the login script checks for the authenticity of the user and then redirects to inbox page using header function.

<         


        
10条回答
  •  青春惊慌失措
    2020-11-22 04:01

    I had the same issue for a while and had a very hard time figuring it out. My problem was that I had the site working for a while with the sessions working right, and then all of the sudden everything broke.

    Apparently, your session_save_path(), for me it was /var/lib/php5/, needs to have correct permissions (the user running php, eg www-data needs write access to the directory). I accidentally changed it, breaking sessions completely.

    Run sudo chmod -R 700 /var/lib/php5/ and then sudo chown -R www-data /var/lib/php5/ so that the php user has access to the folder.

提交回复
热议问题