Re: session.cookie_path problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is PHP sending the correct path in it headers for the cookie?
Use FireFox + LiveHTTPHeader to find out.

Is your BROWSER correctly honoring the path?
It shouldn't be sending back the cookie for app1 in app2, but, if it
does, PHP won't know it wasn't supposed to, I don't think...

On Sun, June 10, 2007 6:15 am, Lasse Brandt wrote:
> Hi,
>
> I am having some trouble with my sessions cookie_path - it doesn't
> seem to work - or maybe I am not working, I don't know at the moment
> :)
>
> Apache 2.2.3 and PHP 5.3.2 as module.
>
> What I want to achieve, is 2 separate sessions in the same website -
> in different directories of course.
>
> My test setup is the following:
>
> http://sessiontest.dev.codefrog.dk/app1/.htaccess contains
>         php_value session.cookie_path /app1/
>
> http://sessiontest.dev.codefrog.dk/app1/index.php contains
> <?php
>         session_start();
>
>         $_SESSION['val1'] = "test1";
>
>         print_r($_SESSION);
>         print_r(session_get_cookie_params());
> ?>
>
> and
>
> http://sessiontest.dev.codefrog.dk/app2/.htaccess contains
>         php_value session.cookie_path /app2/
>
> http://sessiontest.dev.codefrog.dk/app2/index.php contains
> <?php
>         session_start();
>
>         $_SESSION['val2'] = "test2";
>
>         print_r($_SESSION);
>         print_r(session_get_cookie_params());
> ?>
>
> I visit /app1/ and $_SESSION contains 'val1' => 'test1' - as expected.
> I then visit /app2/ and $_SESSION then contains both 'val1' => 'test1'
> and 'val2' => 'test2' - not as expected.
>
> I would expect that each $_SESSION would only hold its own data.
>
> And I can see from the print_r(session_get_cookie_params()) that the
> cookie has changed its path like it should according to my .htaccess
> file.
>
> Am I missing something obvious?
>
> --
>
> Kind Regards
> Lasse Brandt
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux