#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    I've recently set up PHP on a Solaris box. Pretty simple. I've had no problems with the installation. However, I can't seem to get Sessions to work correctly. A session will establish itself, i.e. a file will create itself in /tmp, and if I turn on --enable-trans-sid, I can see the ID. Auto-start will work too, if I turn it on.
    The problem is that 1) I can't seem to access the session id through $PHPSESSID, and 2) nor can I register a variable with a value in the session. The strange thing about the second problem is that the variable will register in the session, but I can't assign it a value.

    I'm thinking that perhaps I have something configured improperly. I have --enable-track-vars on, but otherwise, I don't know what else might need to be done.

    I'm preferring to do this without client-side cookies. I also don't know what needs to be configured for that to work.

    If anyone has any ideas, I'd love to hear them. Thanks.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Newark, DE, USA
    Posts
    39
    Rep Power
    15
    to use any php session variables AND session functions, you have to call session_start( ); first. make sure you've done this in every script in which you want to use your session variables.

    ------------------
    ~Chris
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by cwwesley:
    to use any php session variables AND session functions, you have to call session_start( ); first. make sure you've done this in every script in which you want to use your session variables.

    [/quote]

    Definitely did that already. The session creates itself and variables register. I just can't put values in them.

  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    What do you mean you can't put values in them? How are you trying to make assignments?

    Nothing to it:

    session_start();
    $foo='bar';
    session_register('foo');
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Newark, DE, USA
    Posts
    39
    Rep Power
    15
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by code:
    Definitely did that already. The session creates itself and variables register. I just can't put values in them.
    [/quote]

    If you can, post the code in question, plz.

    ------------------
    ~Chris
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Straight out of the tutorial:

    <?php

    // initialize a session
    session_start();

    // register a session variable
    session_register('counter');

    // increment and display the value of the counter
    $counter++;
    echo("You have visited this page $counter times! Don't you have anything
    else to do, you bum?!");

    ?>

    The resulting session file after multiple refreshes:

    !counter|

    Straight out of a devshed tutorial
    Doesn't appear to store a value like it's supposed to.

Similar Threads

  1. URL session handling problem
    By rec3000 in forum PHP Development
    Replies: 6
    Last Post: February 24th, 2009, 08:33 AM
  2. Replies: 0
    Last Post: February 8th, 2004, 09:55 AM
  3. Passing a session id
    By Vmusic in forum PHP Development
    Replies: 5
    Last Post: January 15th, 2004, 07:28 AM
  4. Smbfs: session setup failed
    By Datamike in forum Linux Help
    Replies: 1
    Last Post: December 5th, 2003, 04:56 PM
  5. php session setup
    By ruzle in forum PHP Development
    Replies: 0
    Last Post: September 5th, 2003, 11:43 AM

IMN logo majestic logo threadwatch logo seochat tools logo