Lost $_SESSION in Google Chrome [message #178589] |
Tue, 10 July 2012 09:02  |
Falk Fiedler
Messages: 3 Registered: August 2011
Karma: 0
|
Junior Member |
|
|
hello,
my local Google Chrome loses session on every page request. I tested with:
<?php
session_start();
echo session_id()."<br>";
if(!isset($_SESSION['temp']))
{
$_SESSION['temp']=99;
}
else
{
$_SESSION['temp']--;
}
echo $_SESSION['temp'];
?>
the session_id() is new on every page request and the $_SESSION['temp' is always 99.
But only on my local webserver. The script works on a webspace. What's wrong with the local config of Chrome?
Thank you
Falk
|
|
|
|
|
|
|
|
|
|
Re: Lost $_SESSION in Google Chrome [message #178608 is a reply to message #178607] |
Wed, 11 July 2012 21:33   |
Peter H. Coffin
Messages: 245 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Wed, 11 Jul 2012 19:36:57 +0200, Arno Welzel wrote:
> Erwin Moller, 11.07.2012 16:39:
>
>> On 7/11/2012 3:44 PM, Silver Moonstone wrote:
>>> On Tuesday, July 10, 2012 2:32:28 PM UTC+5:30, (unknown) wrote:
>>>> hello,
>>>>
>>>> my local Google Chrome loses session on every page request. I tested
>>>> with:
>>>>
>
> [Session seems not to work with local webserver]
>
>>> try clearing the browser cache.
>>> it sometimes happens because chrome fetches the page from the cache.
>>>
>>
>> That may be true, but it is a poor solution since you cannot expect your
>> visitors to do the same in order to use the site.
>
> But you could ensure, that caching will not happen at all by sending the
> appropriate headers.
and by "ensure", you actually mean "suggest".
--
"To every complex problem there is a solution which is
simple, neat and wrong" - HL Mencken
|
|
|
Re: Lost $_SESSION in Google Chrome [message #178617 is a reply to message #178607] |
Thu, 12 July 2012 04:00   |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 7/11/2012 1:36 PM, Arno Welzel wrote:
> Erwin Moller, 11.07.2012 16:39:
>
>> On 7/11/2012 3:44 PM, Silver Moonstone wrote:
>>> On Tuesday, July 10, 2012 2:32:28 PM UTC+5:30, (unknown) wrote:
>>>> hello,
>>>>
>>>> my local Google Chrome loses session on every page request. I tested
>>>> with:
>>>>
>
> [Session seems not to work with local webserver]
>
>>> try clearing the browser cache.
>>> it sometimes happens because chrome fetches the page from the cache.
>>>
>>
>> That may be true, but it is a poor solution since you cannot expect your
>> visitors to do the same in order to use the site.
>
> But you could ensure, that caching will not happen at all by sending the
> appropriate headers.
>
>
Incorrect. Information sent in the headers is a suggestion, not a
requirement. Browsers are free to ignore things like cache control (and
almost anything else).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: Lost $_SESSION in Google Chrome [message #178621 is a reply to message #178608] |
Fri, 13 July 2012 08:57   |
Arno Welzel
Messages: 317 Registered: October 2011
Karma: 0
|
Senior Member |
|
|
Am 11.07.2012 23:33, schrieb Peter H. Coffin:
> On Wed, 11 Jul 2012 19:36:57 +0200, Arno Welzel wrote:
>> Erwin Moller, 11.07.2012 16:39:
>>
>>> On 7/11/2012 3:44 PM, Silver Moonstone wrote:
>>>> On Tuesday, July 10, 2012 2:32:28 PM UTC+5:30, (unknown) wrote:
>>>> > hello,
>>>> >
>>>> > my local Google Chrome loses session on every page request. I tested
>>>> > with:
>>>> >
>>
>> [Session seems not to work with local webserver]
>>
>>>> try clearing the browser cache.
>>>> it sometimes happens because chrome fetches the page from the cache.
>>>>
>>>
>>> That may be true, but it is a poor solution since you cannot expect your
>>> visitors to do the same in order to use the site.
>>
>> But you could ensure, that caching will not happen at all by sending the
>> appropriate headers.
>
> and by "ensure", you actually mean "suggest".
Well... yes, when you assume that certain browsers or proxies ignore
caching related headers.
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
|
|
|
Re: Lost $_SESSION in Google Chrome [message #178622 is a reply to message #178617] |
Fri, 13 July 2012 08:58   |
Arno Welzel
Messages: 317 Registered: October 2011
Karma: 0
|
Senior Member |
|
|
Am 12.07.2012 06:00, schrieb Jerry Stuckle:
> On 7/11/2012 1:36 PM, Arno Welzel wrote:
>> Erwin Moller, 11.07.2012 16:39:
>>
>>> On 7/11/2012 3:44 PM, Silver Moonstone wrote:
>>>> On Tuesday, July 10, 2012 2:32:28 PM UTC+5:30, (unknown) wrote:
>>>> > hello,
>>>> >
>>>> > my local Google Chrome loses session on every page request. I tested
>>>> > with:
>>>> >
>>
>> [Session seems not to work with local webserver]
>>
>>>> try clearing the browser cache.
>>>> it sometimes happens because chrome fetches the page from the cache.
>>>>
>>>
>>> That may be true, but it is a poor solution since you cannot expect your
>>> visitors to do the same in order to use the site.
>>
>> But you could ensure, that caching will not happen at all by sending the
>> appropriate headers.
>>
>>
>
> Incorrect. Information sent in the headers is a suggestion, not a
> requirement. Browsers are free to ignore things like cache control (and
> almost anything else).
Yes, you're right. But at least the chance that caching will not happen
is much higher when sending the appriopriate headers.
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
|
|
|
Re: Lost $_SESSION in Google Chrome [message #178623 is a reply to message #178589] |
Fri, 13 July 2012 09:27  |
J.O. Aho
Messages: 194 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 10/07/12 11:02, falk(dot)fiedler(at)googlemail(dot)com wrote:
> my local Google Chrome loses session on every page request. I tested with:
>
> the session_id() is new on every page request and the $_SESSION['temp' is always 99.
>
> But only on my local webserver. The script works on a webspace. What's wrong with the local config of Chrome?
Check your cookie permissions for your local site in chrome, most likely
you have a deny cookies in your Chrome.
If it had been a code issue, then you had the same result, no matter
which browser you tried.
--
//Aho
|
|
|