problem with use session

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

    problem with use session

    hello,
    i have problem with session, reading on the manual of php.net, i have
    understood that:

    PAGE1.PHP:
    session_start ();
    $_SESSION['myVar'] = myVarValue;

    and for read in:

    PAGE2.PHP
    session_start ();
    print $_SESSION['myVar'];

    should be display the value of myVar.
    Now, all this not work, someone explain me, where is my error? and correct
    me? Thanks you for help.
    Cooper.


  • Matthias Esken

    #2
    Re: problem with use session

    "Cooper" <cooper@bluewar e.it> schrieb:
    [color=blue]
    > PAGE1.PHP:
    > session_start ();
    > $_SESSION['myVar'] = myVarValue;
    >
    > and for read in:
    >
    > PAGE2.PHP
    > session_start ();
    > print $_SESSION['myVar'];
    >
    > should be display the value of myVar.
    > Now, all this not work, someone explain me, where is my error?[/color]

    Four questions:
    1: Does your client accept cookies?
    2: Do you have a PHP version >= 4.1.0
    3: Is session.save_pa th in the php.ini set to a correct path?
    4: Do you use error_reporting = E_ALL?

    Matthias

    Comment

    • Cooper

      #3
      Re: problem with use session

      "Matthias Esken" <muelleimer2003 @usenetverwaltu ng.org> ha scritto nel
      messaggio news:bg08ga.13c .1@usenet.esken .de...[color=blue]
      > "Cooper" <cooper@bluewar e.it> schrieb:
      >[color=green]
      > > PAGE1.PHP:
      > > session_start ();
      > > $_SESSION['myVar'] = myVarValue;
      > >
      > > and for read in:
      > >
      > > PAGE2.PHP
      > > session_start ();
      > > print $_SESSION['myVar'];[/color]
      >[/color]
      [color=blue]
      > Four questions:
      > 1: Does your client accept cookies?[/color]
      YES
      [color=blue]
      > 2: Do you have a PHP version >= 4.1.0[/color]
      YES
      [color=blue]
      > 3: Is session.save_pa th in the php.ini set to a correct path?
      >[/color]
      what is correct path, in my php.ini i have this line:
      session.save_pa th = /tmp
      [color=blue]
      > 4: Do you use error_reporting = E_ALL?
      >[/color]
      In my php.ini is not present line: error_reporting = E_ALL

      Cooper.

      PS: I use Windows XP Professional, PHP work correctly, only this not work,
      in this time, i have verified code in remote and work correctly, only in
      local not work :(
      What i do?


      Comment

      • Matthias Esken

        #4
        Re: problem with use session

        "Cooper" <cooper@bluewar e.it> schrieb:
        [color=blue][color=green]
        >> 3: Is session.save_pa th in the php.ini set to a correct path?
        >>[/color]
        > what is correct path, in my php.ini i have this line:
        > session.save_pa th = /tmp[/color]

        That is OK if you're working on a UNIX machine. On a Windows OS it
        should be something like
        session.save_pa th = C:/temp
        Of course C:\temp must exist. :-)
        [color=blue][color=green]
        >> 4: Do you use error_reporting = E_ALL?
        >>[/color]
        > In my php.ini is not present line: error_reporting = E_ALL[/color]

        I'm not quite sure what's the default value. Add
        error_reporting = E_ALL
        display_errors = On
        to your php.ini, so PHP will show you all the warnings and errors from
        your scripts.


        I think your problem is, that PHP tries to write the session data do the
        folder /tmp, does not find the folder and writes nothing, so your
        session data is lost. You don't get any information about this, because
        you've got no error_reporting .

        Ciao,
        Matthias

        Comment

        • Cooper

          #5
          Re: problem with use session

          "Matthias Esken" <muelleimer2003 @usenetverwaltu ng.org> ha scritto nel
          messaggio news:bg0l7u.ag. 1@usenet.esken. de...
          [Cut][color=blue]
          > I think your problem is, that PHP tries to write the session data do the
          > folder /tmp, does not find the folder and writes nothing, so your
          > session data is lost. You don't get any information about this, because
          > you've got no error_reporting .
          >[/color]

          Ok thanks :) Now work, problem was folder, was sufficient to make tmp in c:\
          and solved :)
          Thank you very much :)
          Cooper.


          Comment

          Working...