php4+apache1.3+xp with sessions not working...

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

    php4+apache1.3+xp with sessions not working...

    Please help.

    I seem to have a major problem with sessions on my setup. No simple
    example seems to work. Example below:

    page1.php:

    <?php
    // page1.php

    session_start() ;

    echo 'Welcome to page #1';

    $_SESSION['favcolor'] = 'green';
    $_SESSION['animal'] = 'cat';
    $_SESSION['time'] = time();

    // Works if session cookie was accepted
    echo '<br /><a href="page2.php ">page 2</a>';

    // Or maybe pass along the session id, if needed
    echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
    ?>

    Page2.php:

    <?php
    // page2.php

    session_start() ;

    echo 'Welcome to page #2<br />';

    echo $_SESSION['favcolor']; // green
    echo $_SESSION['animal']; // cat
    echo date('Y m d H:i:s', $_SESSION['time']);

    // You may want to use SID here, like we did in page1.php
    echo '<br /><a href="page1.php ">page 1</a>';
    ?>

    Output after pressing page2 link:

    Welcome to page #2
    1970 01 01 00:00:00
    page 1



    As you may be able to see, page 1 sets the date but page 2 thinks the
    variable is not set and the 2 other bits, green and cat are also not
    displayed. I have been told that this should work fine. Please tell me
    what to look for in my setup?

    Thanks
    Dan
  • Matthias Esken

    #2
    Re: php4+apache1.3+ xp with sessions not working...

    dan.j.walker@ta lk21.com (Dan Walker) schrieb:
    [color=blue]
    > I seem to have a major problem with sessions on my setup. No simple
    > example seems to work.[/color]

    According to your subject I assume you're using Windows. Did you alter
    the php.ini to set a coorect path for the seesion data?

    This should be something like:

    session.save_pa th = E:/temp

    Regards,
    Matthias

    Comment

    Working...