problem with sessions config.
| From: | N . Boatswain | Date: | Sat, 22 Mar 2008 04:45:14 +0000 |
| Subject: | problem with sessions config. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-271961@lists.php.net to get a copy of this message | ||
Hello guys; i'm having a problem with session behavior; i'm going straight to it, but
first some considerations:
PHP Version 5.2.5IIF 5.1Running on localhost (XP machine)I start sessions at the top of every page.
A the start of a test page, just as example, i do the assignment: $_SESSION["username"]
= "aaa";
At the end of the same page i print it's value: echo $_SESSION["username"];
And i get the layout: "aaa", as expecteed.
Then I redirect to another page. On that one, after initializating the session
("session_start();") print again the $_SESSION["username"] content and the
result is empty. If i try the same code on a server (all this is on my local machine), the code
works as expected; so i think it is a configuration problem, here is my php.ini part that correspond
to session configuration, so you can tell my if i'm doing anything wrong, long comments where
removed:
[Session]; Handler used to store/retrieve data.session.save_handler = files;session.save_path =
"/tmp" BC 13/12/07session.save_path="/tmp"; Whether to use
cookies.session.use_cookies = 1;session.cookie_secure = ; This option enables administrators to make
their users invulnerable to; attacks which involve passing session ids in URLs; defaults to
0.session.use_only_cookies = 1; Name of the session (used as cookie name).session.name = PHPSESSID;
Initialize session on request startup.session.auto_start = 1; Lifetime in seconds of cookie or, if
0, until browser is restarted.session..cookie_lifetime = 0; The path for which the cookie is
valid.session.cookie_path = /; The domain for which the cookie is valid.session.cookie_domain =;
Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser
scripting languages such as JavaScript.session.cookie_httponly = ; Handler used to serialize data.
php is the standard serializer of PHP.session.serialize_handler = php; Define the probability that
the 'garbage collection' process is started; on every session initialization.; The
probability is calculated by using gc_probability/gc_divisor,; e.g. 1/100 means there is a 1% chance
that the GC process starts; on each request.session.gc_probability = 1session.gc_divisor = 1000;
After this number of seconds, stored data will be seen as 'garbage' and; cleaned up by the
garbage collection process.session.gc_maxlifetime = 1440session..bug_compat_42 =
0session.bug_compat_warn = 1; Check HTTP Referer to invalidate externally stored URLs containing
ids.; HTTP_REFERER has to contain this substring for the session to be; considered as
valid.session.referer_check =; How many bytes to read from the file.session.entropy_length = 0;
Specified here to create the session id.session.entropy_file =;session.entropy_length =
16;session.entropy_file = /dev/urandom; Set to {nocache,private,public,} to determine HTTP caching
aspects; or leave this empty to avoid sending anti-caching headers.session.cache_limiter = nocache;
Document expires after n minutes.session.cache_expire = 180session.use_trans_sid = 0; Select a hash
function; 0: MD5 (128 bits); 1: SHA-1 (160 bits)session.hash_function = 0; Define how many bits
are stored in each character when converting; the binary hash data to something readable.;; 4 bits:
0-9, a-f; 5 bits: 0-9, a-v; 6 bits: 0-9, a-z, A-Z, "-",
","session.hash_bits_per_character = 5; The URL rewriter will look for URLs in a defined
set of HTML tags.; form/fieldset are special; if you include them here, the rewriter will; add a
hidden <input> field with the info which is otherwise appended; to URLs. If you want XHTML
conformity, remove the form entry.; Note that all valid entries require a "=", even if no
value follows.url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
Well, thanks and sorry for my english;
Nicolás.
_________________________________________________________________
Watch “Cause Effect,” a show about real people making a real difference.. Learn more.
http://im.live.com/Messenger/IM/MTV/?source=text_watchcause