session.cookie_path problem
| From: | Lasse Brandt | Date: | Sun, 10 Jun 2007 11:15:33 +0000 |
| Subject: | session.cookie_path problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-256540@lists.php.net to get a copy of this message | ||
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