How can I choose a directory and name the directory to store sessions in?

Discussion in 'PHP' started by Imozeb, Jun 3, 2010.

  1. #1
    I need to create a new directory to store my user sessions in. How would I do this and is it safe?
     
    Imozeb, Jun 3, 2010 IP
  2. trevHCS

    trevHCS Peon

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can alter it by using the session_save_path() function although whether you'd actually want to bother is another matter. Kindof depends how secure the session info needs to be.

    On safety - if it's a shared server then it is a little safer to do this than rely on the /tmp dircectory although personally I'd make sure it's just under the /public_html (or similar) directory so that it's not readable by anyone browsing with a web browser. Eg: /home/username/session_ids/ instead of /home/username/public_html/session_ids/

    Trev
     
    trevHCS, Jun 3, 2010 IP
  3. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Okay. Thanks for the info!
     
    Imozeb, Jun 5, 2010 IP