PHP session empty

后端 未结 4 599
半阙折子戏
半阙折子戏 2020-12-07 06:12

I made a simple login function in PHP. My problem is that there are no session attributes when the browser hits page login_success.php

After i store

相关标签:
4条回答
  • 2020-12-07 06:20

    Apart from using session_start(), there can be a couple of other reasons as well:

    1. Disk space is full on your server. This once happened to be the case with me. Try checking the available space on your server at root '/' (df -h).
    2. The sessions directory on your server (where the session files are being written) has some permission issues.
    0 讨论(0)
  • 2020-12-07 06:29

    Configure your php.ini like this:

    session.auto_start = 1;
    

    Or run following command at your first line:

    ini_set('session.auto_start', 1);
    
    0 讨论(0)
  • 2020-12-07 06:39

    Just use <?php session_start() ?> on top of page.

    0 讨论(0)
  • 2020-12-07 06:45

    According to the php documentation: session_start

    session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.

    So add session_start() to the top of your checklogin.php page.

    0 讨论(0)
提交回复
热议问题