tags:

views:

141

answers:

5

session id is not unique between 1.php and 2.php.

1.php basically sets $_SESSION['var'] = "hello"

and 2.php: print_r($_SESSION['var'])

echoing out session_id() shows different id. same browser (firefox).

everything was working fine, until I screwed up the .htaccess. I deleted .htaccess and restarted apache2.

A: 

It sounds like you most likely need to set the session.save_path for PHP.

PHP: session_ save_ path reference

Brian Mansell
and/or to start the session
Wez Furlong
A: 

yes i am doing both./var/lib/php5 is for both pages....

also, 1.php is loaded via iframe.....

2.php is not.

A: 

Sessions on PHP have always caused issues for me, these days I have moved onto the Zend Framework which has a Zend_Session component that takes care of most of the issues for me and I have to do less thinking. Take a look and see if that would work for you as well!

X-Istence
A: 

take a look at http://stackoverflow.com/questions/1371649/php-session-ids-differ/1371823#1371823

--edit--

"everything was working file...until you messesd up with .htaccess" : it means you had some kind of internal redirection setup in there. Take a look at http://enarion.net/web/apache/htaccess/redirect-www-and-no-www/

Quamis
A: 

You use $var variable somewhere in your code either on 1.php or on 2.php Try to change the $var to $some_thing_else

When you use $_SESSION this is common problem.

Tareq