PHP session handling errors

后端 未结 13 1114
感动是毒
感动是毒 2020-12-15 17:33

I have this at the very top of my send.php file:

ob_start();
@session_start();

//some display stuff

$_SESSION[\'id\'] = $id; //$id has a value         


        
相关标签:
13条回答
  • 2020-12-15 18:24

    This was a known bug in version(s) of PHP . Depending on your server environment, you can try setting the sessions folder to 777:

    /var/lib/php/session (your location may vary)

    I ended up using this workaround:

    session_save_path('/path/not/accessable_to_world/sessions');
    ini_set('session.gc_probability', 1);
    

    You will have to create this folder and make it writeable. I havent messed around with the permissions much, but 777 worked for me (obviously).

    Make sure the place where you are storing your sessions isn't accessible to the world.

    This solution may not work for everyone, but I hope it helps some people!

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