I have an application that works with session variables without problems. I start a session in front of the headers on every page that uses when it was good, then it seems to me that I get an undefined index error when going to a page other than the one that sets the session variables. But only on some browsers . Sometimes sessions are supported, and sometimes not.
Cookies do not seem to be stored for a while. I did checks using different browsers, and sometimes cookies are stored, and sometimes not.
I did an experiment. I used Firefox for use in the application, and I kept track of the tmp folder where the sessions are stored. I cleaned it. Using firefox, I started using the application using all the pages on which the sessions were, and in the end I checked the tmp folder and there was one session file.
The same thing happened with Internet Explorer, and now there are 7 different session files.
I am using PHP 5.3.0 with a WAMP stack. Apache 2.2.11. Session support is included in my phpinfo ().
I call the var dump on the first page and prints the session data. On any subsequent pages, the session variable is empty.
<?php var_dump($_SESSION); ?> array(0){}
Can someone help me figure out the solution?
UPDATE - PHP INI SESSION settings
Directive Local Value Master Value session.auto_start Off Off session.bug_compat_42 On On session.bug_compat_warn On On session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain 82.68.26.169 82.68.26.169 session.cookie_httponly Off Off session.cookie_lifetime 0 0 session.cookie_path / / session.cookie_secure Off Off session.entropy_file no value no value session.entropy_length 0 0 session.gc_divisor 1000 1000 session.gc_maxlifetime 1440 1440 session.gc_probability 1 1 session.hash_bits_per_character 5 5 session.hash_function 0 0 session.name PHPSESSID PHPSESSID session.referer_check no value no value session.save_handler files files session.save_path c:/wamp/tmp c:/wamp/tmp session.serialize_handler php php session.use_cookies On On session.use_only_cookies On On session.use_trans_sid 0 0
UPDATE - Solution
Since my application used an iframe that was pulling pages from another domain (which I created), the cookies I was trying to set were blocked. Adjust the P3P header and the problem seems to be resolved!
php cookies session-cookies session-variables wamp
iamjonesy
source share