PHP Sessions Not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • burhanbajwa
    New Member
    • Aug 2007
    • 1

    PHP Sessions Not working

    Hello experts
    i m a new one in PHP.i have developed an application and i m facing session problem.
    session_start() ; is obvious on everypage.
    but wen i login after user validation where session varaibles are created the page is redirected by a header to the main page.but here i dont fine my session varibales
    as in validating page
    session_start() ;
    $_session['a']="somthing";
    and on the next page there is nothing in
    $_session['a'] .
    One thing i have noticed that on next page new session is created.
    which is different from the previous page session id.
    i m using php4.4.7 and register_global is on and session.use_tra ns_sid is off
    session.auto_st art is off and session.use_coo kies is On.
    i m working on it from last three days and it is the first time i m posting any thing on a forum.
    and i m sure i'll get an appreciateable response.
    Thanks
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi. Welcome to The Scripts!

    First of all I would recommend turning register_global s Off. Enabling this is a security risk and is very likely to cause problems in the future.

    Getting to your actual problem...

    What platform is your server running on?
    If it is Windows you will have to create a directory for the session data and set the 'session.save_p ath' to that directory. It is also very important that you give PHP permission to use that directory. (I usually give everyone full access to it)

    If this doesn't help you, please post the code that is causing the problem and the code where you start the session.

    Comment

    • momogi
      New Member
      • Sep 2007
      • 28

      #3
      Originally posted by Atli
      If it is Windows you will have to create a directory for the session data and set the 'session.save_p ath' to that directory. It is also very important that you give PHP permission to use that directory. (I usually give everyone full access to it)
      Hi Atli..

      I wanna know how to configure php.ini in order to give PHP permission to access session.save_pa th's directory...
      Looking forward to your answer... :)

      --Thank You--

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Hi momogi.

        Folder permissions are not configured in php.ini.

        To give PHP permission to a folder, you must give the user that is running the PHP service permission to use the folder. How that is done will depend on what operation system you are running.

        Comment

        • momogi
          New Member
          • Sep 2007
          • 28

          #5
          Originally posted by Atli
          Hi momogi.

          Folder permissions are not configured in php.ini.

          To give PHP permission to a folder, you must give the user that is running the PHP service permission to use the folder. How that is done will depend on what operation system you are running.
          Oh.. I see...

          Thank you Atli.. :)

          Comment

          Working...