NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP $_SESSION

Néstor rotsen at gmail.com
Thu Jun 5 14:34:08 EDT 2008


How can I check to see that the problem is that the session files are
writable
to the disk?  How do I catch the error?
my session.path.save points to /var/lib/php/session

Thanks,



On Thu, Jun 5, 2008 at 11:14 AM, Tim Lieberman <tim_lists at o2group.com>
wrote:

> There's a section in the phpinfo() output called session.
> Compare those sections between the two php versions.  If you don't see
> anything obvious, post at least the php5 config here, and maybe we'll see
> something.
>
> It sounds to me like wherever PHP5 is trying to save session files on disk
> is not writable, but it could be any number of things.
>
> -Tim
>
> On Jun 5, 2008, at 12:05 PM, Néstor wrote:
>
> To answer the last 3 postings
>
> I get the session_id() and save it in $_SESSION['mysession']
> then in every page I compare them if not the same then I send the user back
> to
> the login page:
>   if($_SESSION['mysession'] != session_id() ){
>      // redirect to the HR admin page
>      header("Location:/login.php");
>   }
>
> The redirect works!!!
>
> YES!    $_SESSION['mysession'] is empty,  the session information is
> disappearing
> from one page to the other.
>
> When i do a phpinfo() I do not have any $_SESSION variables;
>
>
>
>
>
> On Thu, Jun 5, 2008 at 10:55 AM, David Krings <ramons at gmx.net> wrote:
>
>> 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
>>
>> _______________________________________________
>> New York PHP Community Talk Mailing List
>> http://lists.nyphp.org/mailman/listinfo/talk
>>
>> NYPHPCon 2006 Presentations Online
>> http://www.nyphpcon.com
>>
>> Show Your Participation in New York PHP
>> http://www.nyphp.org/show_participation.php
>>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080605/90a56321/attachment.html>


More information about the talk mailing list