session_set_cookie_params and session_save_path

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • turnitup

    session_set_cookie_params and session_save_path

    I seem to be able to get these to work separately, but not together.

    So if I do

    session_save_pa th("/blah/blah/")

    it saves my sessions to that path.

    but if I follow it by
    session_set_coo kie_params(nnnn , "/blah/blah/")

    it breaks session_start.

    however

    session_set_coo kie_params(nnnn );
    session_start() ;

    works fine!!

    Is there something I am doing wrong, or is there a workaround?
    Basically, I need a system which allows a browser to sit idle for a
    number of hours for what is an intranet application, but I need my
    sessions stored to a specific location.

    Any ideas? Thanks in advance
  • Andy Hassall

    #2
    Re: session_set_coo kie_params and session_save_pa th

    On Fri, 13 Oct 2006 20:29:54 +0100, turnitup <same@samewrote :
    >I seem to be able to get these to work separately, but not together.
    >
    >So if I do
    >
    >session_save_p ath("/blah/blah/")
    >
    >it saves my sessions to that path.
    >
    >but if I follow it by
    >session_set_co okie_params(nnn n, "/blah/blah/")
    >
    >it breaks session_start.
    You've possibly misunderstood the "path" parameter on
    session_set_coo kie_params - it's the URL path prefix for which the cookie
    applies - corresponding to the path parameter on setcookie() - it is not the
    session save path.

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Pedro Graca

      #3
      Re: session_set_coo kie_params and session_save_pa th

      turnitup wrote:
      if I do
      >
      session_save_pa th("/blah/blah/")
      Session data is saved to /blah/blah
      it saves my sessions to that path.
      >
      but if I follow it by
      session_set_coo kie_params(nnnn , "/blah/blah/")
      >
      it breaks session_start.
      The client sends cookies to pages in "http://www.yourserver. com/blah/blah"
      but the script where you call session_start() is not in that directory,
      so it never receives a session id from the client.
      however
      >
      session_set_coo kie_params(nnnn );
      Unless you changed `session.cookie _path` in php.ini, this is the
      same as

      session_set_coo kie_params(nnnn , '/');
      session_start() ;
      >
      works fine!!
      The client and the server are in synch! :)
      Is there something I am doing wrong, or is there a workaround?
      Basically, I need a system which allows a browser to sit idle for a
      number of hours for what is an intranet application, but I need my
      sessions stored to a specific location.
      Do not use session_set_coo kie_params(), or, if you must, keep it short
      and omit the 'path` parameter.

      --
      File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

      Comment

      • turnitup

        #4
        Re: session_set_coo kie_params and session_save_pa th

        Thank you all for your replies. I will see how it goes.

        Comment

        Working...