[PHP] session.cookie_path problem

2007-06-10 Thread Lasse Brandt

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



[PHP] Re: session.cookie_path problem

2007-06-10 Thread Lasse Brandt

Am I missing something obvious?


I am so sorry - I was missing something obvious.

At some early stage of my test, I had a /index.php on my test website
doing a: session_start()
And the apparently made my session work in both sub directories and
thus poisoning my test result.

After closing my browser and going straight to /app1/ and then /app2/
I actually got the correct result.

So sorry to disturb you - have a nice day :)

--

Kind Regards
Lasse Brandt

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