[nycphp-talk] PHP $_SESSION
David Krings
ramons at gmx.net
Thu Jun 5 13:55:26 EDT 2008
Néstor wrote:
> I understand this. Like I said it is not working on PHP 5.1.
> I do the session_start()
> and then I put the session_id() into my $_SESSION['mysession'];
>
> The problem is that my $_SESSION['mysession'] is empty on php 5.1
> when it was not in php 4.1.
>
Out of curiosity, why do you store the session ID in the session array when
session_id() will give you what you are looking for? And then, what does
session_id() produce? If that is an empty value then $_SESSION['mysession']
will be empty as well.
> Apparently a logs of people where having this problim according to this
> link:
> http://bugs.php.net/bug.php?id=16263
>
> I am reading the above link to see what the answer to the problem is.
> I was hoping that some one on this list had seen this problem and
> knows the answer.
The answers boil down to two things:
1. Check where the session files are written to and make sure that PHP has
full access to that place and that nothing else wipes those files out.
2. Use this:
<?php
session_start();
header("Cache-control: private");
I use sessions extensively in my projects and didn't find that there is any
issue. I do set the cache control.
HTH
David
More information about the talk
mailing list