Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #17731

Re: PHP sessions

From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: PHP sessions
Date 2018-05-06 18:57 +0200
Message-ID <fl8qf8FahvfU1@mid.individual.net> (permalink)
References <pcmdpu$2ek$1@dont-email.me> <pcmmoc$b4p$1@solani.org> <pcmqnr$n17$1@dont-email.me>

Show all headers | View raw


On 05/06/18 13:59, madwomans Dad wrote:
> On 06/05/2018 11:51, Christoph M. Becker wrote:
>> On 06.05.2018 at 10:19, madwomans Dad wrote:
>>
>>> I'm very familiar with Java and I'm trying to compare PHP session
>>> handling with J2EE session handling and I've come up with a bit of a
>>> problem.
>>>
>>> I get the following output
>>> step1 - check session -
>>> there is no session
>>> starting session
>>> session started
>>> there is an active session
>>>
>>> if I then enable the redirect to step2.php
>>>
>>> I would expect to see "there is an active session" but what I get is
>>>
>>> step2 - check session -
>>> there is no session
>>>
>>> Huh! what am I missing
>>
>> You have to start the session for each request, since PHP closes
>> sessions automatically at the end of the request.
>>
> I clicked reply. I should have clicked follow up. Apologies to C M B
> 
> Anyway
> 
> What the heck is the point of a session object that closes automatically
> at the end of a request?

Why use a session on a page which do not require a such? ;)


> The whole point of a session is that it stays
> active for a particular sequence of requests or a users 'session' onĀ  a
> particular web site.

As people have already pointed out, the session_start will resume the
current session as long as it hasn't expired or nullified.


> This makes no sense at all. There must be way to track a session in PHP.

auto_prepend_file in php.ini file can load a script automatically for
you which can have the session_start, then it's more like you want it to
be, but don't forget to document that or else next guy fixing the site
won't know how the session is started by magic.


-- 

 //Aho

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

PHP sessions madwomans Dad <dsvirtual58@gmail.com> - 2018-05-06 09:19 +0100
  Re: PHP sessions "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-05-06 12:51 +0200
    Re: PHP sessions madwomans Dad <dsvirtual58@gmail.com> - 2018-05-06 12:59 +0100
      Re: PHP sessions "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-05-06 14:11 +0200
      Re: PHP sessions Gregor Kofler <usenet@gregorkofler.com> - 2018-05-06 14:13 +0200
        Re: PHP sessions madwomans Dad <dsvirtual58@gmail.com> - 2018-05-06 14:08 +0100
          Re: PHP sessions "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-05-06 15:22 +0200
            Re: PHP sessions madwomans Dad <dsvirtual58@gmail.com> - 2018-05-06 16:01 +0100
              Re: PHP sessions "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-05-06 17:27 +0200
                Re: PHP sessions madwomans Dad <dsvirtual58@gmail.com> - 2018-05-06 19:17 +0100
      Re: PHP sessions "J.O. Aho" <user@example.net> - 2018-05-06 18:57 +0200
  Re: PHP sessions Richard Damon <Richard@Damon-Family.org> - 2018-05-06 13:21 -0400

csiph-web