Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    This little Earth.
    Posts
    383
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Seemingly simple: session variables not getting passed on

    I've got a very simple session problem but can't seem to figure out what's wrong:

    here's the index page:
    PHP Code:
    <?php session_start();

    if(!isset(
    $_SESSION['uid']))
    {
    $_SESSION['uid'] = $username;
    }
    //some stuff below
    ?>
    and on the next page:
    PHP Code:
    <?php session_start();
    var_dump($_SESSION);
    ?>
    Simple as that. But on the next page $_SESSION is empty.

    My php.ini has:

    session.auto_start: Off
    session.use_cookies: On
    session.use_only_cookies: Off
    session.use_trans_sid: 0

    On my local machine this works fine, but on the server I'm developing (which has the same config in php.ini), variables just don't get passed on.

    Is there something else I should be looking at? The only thing that strikes me as different from my local machine settings is that the server's running IIS. That can't be the problem but I can't think of anything else..
    'If you don't stand for something, you'll fall for anything.'

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,049
    Thanks
    2
    Thanked 317 Times in 309 Posts
    It is highly likely an error is occurring, but is hidden due to the display errors or error reporting settings. Add the following two lines after your first opening <?php tag (put the <?php on its own line, then add these two lines after that, then put your session_start() statement) -

    PHP Code:
    ini_set ("display_errors""1");
    error_reporting(E_ALL); 
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    This little Earth.
    Posts
    383
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh wow.

    Warning: session_start() [function.session-start]: open(C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\php\session\sess_kp0cceqsapmcp367jk5vttv072, O_RDWR) failed: Permission denied (13) in ....

    thank you!
    'If you don't stand for something, you'll fall for anything.'

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    This little Earth.
    Posts
    383
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, I went to that folder (C:\Documents..............\session), gave read/write permissions to the website and refreshed the site on IIS - no change. It still has that O_RDWR fail.

    ---edit
    Actually, it's working now.. thanks
    Last edited by ASAAKI; 03-10-2008 at 10:18 AM.
    'If you don't stand for something, you'll fall for anything.'


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •