Sessions in different versions of PHP

I have tested the 2 scripts below....

aoltest.php
*************
<?php
session_start();
$_SESSION[s_check1] = "4";
?>
click me


aoltest3.php
**************
<?php
session_start();
?>
<body>
The session is <?php echo $_SESSION[s_check1];?><br>
</body>

Both on 2 different servers. 1 running PHP version 5.0.4 and the other
running 4.4.3.

Both work fine until tested with a user on an AOL ISP. The one under
4.4.3 works perfectly but the one under 5.0.4 fails and the session is
not carried accross to the new page.

Any one have any clues why this would happen. Whats the changes/
diferences between 4.4.3 and 5.0.4 that could effect this?

Many Thanks

Mike
Mike [ Do, 22 Februar 2007 17:23 ] [ ID #1638207 ]

Re: Sessions in different versions of PHP

Mike <mike [at] mjfcadsolutions.co.uk> wrote:

> $_SESSION[s_check1] =3D "4";

You mean $_SESSION['s_check1'] =3D "4";
Switch on error_reporting(E_ALL) to see why.

> Both work fine until tested with a user on an AOL ISP. The one under
> 4.4.3 works perfectly but the one under 5.0.4 fails and the session is=

> not carried accross to the new page.
>
> Any one have any clues why this would happen. Whats the changes/
> diferences between 4.4.3 and 5.0.4 that could effect this?

No change between 4.4.3 & 5.0.4 that could do this I'd think. Offcourse,=
2 =

different severs mean 2 possibly different configurations. Compare the =

following settings:
session.name
session.cookie_lifetime
session.cookie_path
session.cookie_domain
session.cookie_secure
session.cookie_httponly
session.use_cookies
session.use_only_cookies
session.referer_check
session.use_trans_sid
url_rewriter.tags

Or possibly examine the difference in Setcookie-headers the 2 different =
=

servers return.
-- =

Rik Wasmus
Rik [ Do, 22 Februar 2007 17:43 ] [ ID #1638209 ]

Re: Sessions in different versions of PHP

"Mike" <mike [at] mjfcadsolutions.co.uk> wrote in message
news:1172161385.402338.197150 [at] a75g2000cwd.googlegroups.com.. .
|I have tested the 2 scripts below....
|
| aoltest.php
| *************
| <?php
| session_start();
| $_SESSION[s_check1] = "4";
| ?>
| click me
|
|
| aoltest3.php
| **************
| <?php
| session_start();
| ?>
| <body>
| The session is <?php echo $_SESSION[s_check1];?><br>
| </body>
|
| Both on 2 different servers. 1 running PHP version 5.0.4 and the other
| running 4.4.3.
|
| Both work fine until tested with a user on an AOL ISP. The one under
| 4.4.3 works perfectly but the one under 5.0.4 fails and the session is
| not carried accross to the new page.
|
| Any one have any clues why this would happen. Whats the changes/
| diferences between 4.4.3 and 5.0.4 that could effect this?

there was a huge discussion about AOL and sessions about a month or two ago.
i'd just search for it as i remember it being resolved.

on another note, unless s_check1 is a constant, i.e. define('s_check1',
'some value'), always be explicit...as in $_SESSION['s_check1']. otherwise,
you will eventually run into problems aside from the fact that you are
writing less than optimal code - it will always be slower because php has to
see if s_check1 is defined literally somewhere else so it can use the
correct value/key or, it will cast it as a string...as opposed to php
knowing it is a string and the value of the string is the key for the
$_SESSION array element.

but that's just my 0.02 usd.
Steve [ Do, 22 Februar 2007 17:42 ] [ ID #1638210 ]

Re: Sessions in different versions of PHP

On 22 Feb, 16:43, Rik <luiheidsgoe... [at] hotmail.com> wrote:
> Mike <m... [at] mjfcadsolutions.co.uk> wrote:
> > $_SESSION[s_check1] = "4";
>
> You mean $_SESSION['s_check1'] = "4";
> Switch on error_reporting(E_ALL) to see why.
>
> > Both work fine until tested with a user on an AOL ISP. The one under
> > 4.4.3 works perfectly but the one under 5.0.4 fails and the session is
> > not carried accross to the new page.
>
> > Any one have any clues why this would happen. Whats the changes/
> > diferences between 4.4.3 and 5.0.4 that could effect this?
>
> No change between 4.4.3 & 5.0.4 that could do this I'd think. Offcourse, 2
> different severs mean 2 possibly different configurations. Compare the
> following settings:
> session.name
> session.cookie_lifetime
> session.cookie_path
> session.cookie_domain
> session.cookie_secure
> session.cookie_httponly
> session.use_cookies
> session.use_only_cookies
> session.referer_check
> session.use_trans_sid
> url_rewriter.tags
>
> Or possibly examine the difference in Setcookie-headers the 2 different
> servers return.
> --
> Rik Wasmus

I've checked the differences above although a couple I couldn't find
like session.cookie_httponly and session.cookie_secure.

url_rewriter.tags is different thought...

Version 4.4.3 = a=href,area=href,frame=src,input=src,form=,fieldset=
Version 5.0.4 = a=href,area=href,frame=src,input=src,form=fakeentry

Would this make a difference and can it be changed with ini_set()?

Thanks

Mike
Mike [ Fr, 23 Februar 2007 09:08 ] [ ID #1638238 ]

Re: Sessions in different versions of PHP

Mike <mike [at] mjfcadsolutions.co.uk> wrote:
> Rik <luiheidsgoe... [at] hotmail.com> wrote:
>> Mike <m... [at] mjfcadsolutions.co.uk> wrote:
>>
>> > Both work fine until tested with a user on an AOL ISP. The one und=
er
>> > 4.4.3 works perfectly but the one under 5.0.4 fails and the session=
is
>> > not carried accross to the new page.
>>
>> > Any one have any clues why this would happen. Whats the changes/
>> > diferences between 4.4.3 and 5.0.4 that could effect this?
>>
>> No change between 4.4.3 & 5.0.4 that could do this I'd think. =

>> Offcourse, 2
>> different severs mean 2 possibly different configurations. Compare th=
e
>> following settings:
>> session.name
>> session.cookie_lifetime
>> session.cookie_path
>> session.cookie_domain
>> session.cookie_secure
>> session.cookie_httponly
>> session.use_cookies
>> session.use_only_cookies
>> session.referer_check
>> session.use_trans_sid
>> url_rewriter.tags
>>
>
> I've checked the differences above although a couple I couldn't find
> like session.cookie_httponly and session.cookie_secure.
>
> url_rewriter.tags is different thought...
>
> Version 4.4.3 =3D a=3Dhref,area=3Dhref,frame=3Dsrc,input=3Dsrc,form=3D=
,fieldset=3D
> Version 5.0.4 =3D a=3Dhref,area=3Dhref,frame=3Dsrc,input=3Dsrc,form=3D=
fakeentry
>
> Would this make a difference and can it be changed with ini_set()?

I wouldn't think so. Is there a difference in the headers? Try to compar=
e =

headers_list() after the session_start() of the two.
-- =

Rik Wasmus
Rik [ Fr, 23 Februar 2007 22:20 ] [ ID #1638265 ]

Re: Sessions in different versions of PHP

On Feb 23, 9:20 pm, Rik <luiheidsgoe... [at] hotmail.com> wrote:
> Mike <m... [at] mjfcadsolutions.co.uk> wrote:
> > Rik <luiheidsgoe... [at] hotmail.com> wrote:
> >> Mike <m... [at] mjfcadsolutions.co.uk> wrote:
>
> >> > Both work fine until tested with a user on an AOL ISP. The one under
> >> > 4.4.3 works perfectly but the one under 5.0.4 fails and the session is
> >> > not carried accross to the new page.
>
> >> > Any one have any clues why this would happen. Whats the changes/
> >> > diferences between 4.4.3 and 5.0.4 that could effect this?
>
> >> No change between 4.4.3 & 5.0.4 that could do this I'd think.
> >> Offcourse, 2
> >> different severs mean 2 possibly different configurations. Compare the
> >> following settings:
> >> session.name
> >> session.cookie_lifetime
> >> session.cookie_path
> >> session.cookie_domain
> >> session.cookie_secure
> >> session.cookie_httponly
> >> session.use_cookies
> >> session.use_only_cookies
> >> session.referer_check
> >> session.use_trans_sid
> >> url_rewriter.tags
>
> > I've checked the differences above although a couple I couldn't find
> > like session.cookie_httponly and session.cookie_secure.
>
> > url_rewriter.tags is different thought...
>
> > Version 4.4.3 = a=href,area=href,frame=src,input=src,form=,fieldset=
> > Version 5.0.4 = a=href,area=href,frame=src,input=src,form=fakeentry
>
> > Would this make a difference and can it be changed with ini_set()?
>
> I wouldn't think so. Is there a difference in the headers? Try to compare
> headers_list() after the session_start() of the two.
> --
> Rik Wasmus- Hide quoted text -
>
> - Show quoted text -

Rik,

I can only use headers_list() on the php5 test as its not available
prior to version 5. Any way the output is as follows...

array(5) { [0]=> string(23) "X-Powered-By: PHP/5.0.4" [1]=> string(56)
"Set-Cookie: PHPSESSID=il8mnvi1hd9pdslbmkldium0r1; path=/" [2]=>
string(38) "Expires: Thu, 19 Nov 1981 08:52:00 GMT" [3]=> string(77)
"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0" [4]=> string(16) "Pragma: no-cache" }

Any good?

Thanks

Mike
Mike [ Di, 27 Februar 2007 15:16 ] [ ID #1641839 ]

Re: Sessions in different versions of PHP

Mike <mike [at] mjfcadsolutions.co.uk> wrote:
>> >> > Both work fine until tested with a user on an AOL ISP. The one =
=

>> under
>> >> > 4.4.3 works perfectly but the one under 5.0.4 fails and the =

>> session is
>> >> > not carried accross to the new page.
>>
>> >> > Any one have any clues why this would happen. Whats the changes=
/
>> >> > diferences between 4.4.3 and 5.0.4 that could effect this?
>>
>> >> Compare>> following settings:
>> > I've checked the differences above although a couple I couldn't fin=
d
>> > like session.cookie_httponly and session.cookie_secure.
>I can only use headers_list() on the php5 test as its not available
> prior to version 5. Any way the output is as follows...
>
>"Set-Cookie: PHPSESSID=3Dil8mnvi1hd9pdslbmkldium0r1; path=3D/"

Is session.cookie_lifetime set to zero, annd if not, what happens if you=
=

do?
-- =

Rik Wasmus
Rik [ Di, 27 Februar 2007 19:02 ] [ ID #1641853 ]

Re: Sessions in different versions of PHP

On Feb 27, 6:02 pm, Rik <luiheidsgoe... [at] hotmail.com> wrote:
> Mike <m... [at] mjfcadsolutions.co.uk> wrote:
> >> >> > Both work fine until tested with a user on an AOL ISP. The one
> >> under
> >> >> > 4.4.3 works perfectly but the one under 5.0.4 fails and the
> >> session is
> >> >> > not carried accross to the new page.
>
> >> >> > Any one have any clues why this would happen. Whats the changes/
> >> >> > diferences between 4.4.3 and 5.0.4 that could effect this?
>
> >> >> Compare>> following settings:
> >> > I've checked the differences above although a couple I couldn't find
> >> > like session.cookie_httponly and session.cookie_secure.
> >I can only use headers_list() on the php5 test as its not available
> > prior to version 5. Any way the output is as follows...
>
> >"Set-Cookie: PHPSESSID=il8mnvi1hd9pdslbmkldium0r1; path=/"
>
> Is session.cookie_lifetime set to zero, annd if not, what happens if you
> do?
> --
> Rik Wasmus- Hide quoted text -
>
> - Show quoted text -

Yep, it is set to zero, on both servers.

Mike
Mike [ Di, 27 Februar 2007 20:40 ] [ ID #1641863 ]
PHP » alt.php » Sessions in different versions of PHP

Vorheriges Thema: testing php on my home computer
Nächstes Thema: Can I get the form name from $_POST?