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


Groups > comp.lang.php > #10723

Strange url session behaviour after upgrade to 5.3 (was: Strange url session behaviour after upgrade to 4.3)

Message-ID <1763596.UuFckHL7rL@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-09-06 00:23 +0200
Subject Strange url session behaviour after upgrade to 5.3 (was: Strange url session behaviour after upgrade to 4.3)
Newsgroups comp.lang.php
References (2 earlier) <PGnVt.46133$Zd2.31433@fx02.iad> <l054hg$7tb$1@dont-email.me> <52262559.80509@tobiah.org> <52262c75$0$6569$9b4e6d93@newsspool3.arcor-online.net> <52277021.10408@tobiah.org>

Show all headers | View raw


Tobiah wrote:

> On 09/03/2013 11:38 AM, Christoph Michael Becker wrote:
>> Tobiah wrote:
>>> The crux I think is that this works:
>>>
>>>        session_id($_COOKIE['PHPSESSID']);
>>>        session_start();
>>>
>>> but plain session_start() does not.
>>
>> You may consider checking the PHP ini settings session.name and
>> session.use_cookies.
> 
> session.name = PHPSESSID
> session.use_cookies = 1
> 
> I wasn't looking too much at the php.ini because the sessions
> work fine when loading normal pages.  I know I'm using the PHPSESSID
> cookie, because when I delete that cookie, my session goes away.
> The only difference here is that instead of using a browser, I'm
> using curl.
> 
> I know that curl is setting the cookie because of the code quoted
> above.

Still, the culprit appears to be the “session.name” or “session.use_cookies” 
configuration setting.  Both settings being PHP_INI_ALL-changeable, they can 
be overridden by

- using the Apache “php_admin_value” and “php_value” directives in
  httpd.conf (including Virtual Host configurations), .htaccess, or
  .user.ini;

- calling ini_set() prior to session_start() or

- calling session_name() prior to session_start().

(In theory, you can configure it in the Windows Registry as well, but 
I think php.ini settings override the settings in the Windows Registry.  
I may be wrong.)

In fact, this is recommended for “session.name”, so that each application on 
a server uses its own session name (unless there is a reason that two 
applications use the same session data).

It would probably be best to make sure what is the setting of “session.name” 
and “session_use_cookies” before you call session_start(), by inserting

  phpinfo(INFO_GENERAL | INFO_CONFIGURATION);

See also:

<http://php.net/manual/en/session.configuration.php>
<http://php.net/manual/en/configuration.changes.modes.php>
<http://php.net/session_name>
<http://php.net/phpinfo>


Please use your full (real) name.

I have also fixed the Subject header field.  Please be more careful next 
time.


PointedEars
-- 
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
  -- Richard Cornford, comp.lang.javascript, 2011-11-14

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


Thread

Strange url session behaviour after upgrade to 4.3 Tobiah <toby@tobiah.org> - 2013-08-30 13:33 -0700
  Re: Strange url session behaviour after upgrade to 4.3 Jerry Stuckle <jstucklex@attglobal.net> - 2013-08-30 20:28 -0400
    Re: Strange url session behaviour after upgrade to 4.3 Tobiah <toby@tobiah.org> - 2013-09-03 08:58 -0700
      Re: Strange url session behaviour after upgrade to 4.3 Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-03 12:59 -0400
        Re: Strange url session behaviour after upgrade to 4.3 Tobiah <toby@tobiah.org> - 2013-09-03 11:07 -0700
          Re: Strange url session behaviour after upgrade to 4.3 Christoph Michael Becker <cmbecker69@arcor.de> - 2013-09-03 20:38 +0200
            Re: Strange url session behaviour after upgrade to 4.3 Tobiah <toby@tobiah.org> - 2013-09-04 10:38 -0700
              Strange url session behaviour after upgrade to 5.3 (was: Strange url session behaviour after upgrade to 4.3) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-09-06 00:23 +0200
          Re: Strange url session behaviour after upgrade to 4.3 Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-03 14:52 -0400
  Re: Strange url session behaviour after upgrade to 4.3 Christoph Michael Becker <cmbecker69@arcor.de> - 2013-08-31 19:58 +0200
  Re: Strange url session behaviour after upgrade to 4.3 Luuk <luuk@invalid.lan> - 2013-08-31 20:47 +0200

csiph-web