problem with sessions config.

This is a discussion on problem with sessions config. within the PHP General forums, part of the PHP Programming Forums category; Hello guys; i'm having a problem with session behavior; i'm going straight to it, but first some considerations: ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-22-2008
N . Boatswain
 
Posts: n/a
Default problem with sessions config.


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 emptyto 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, therewriter will; add a hidden <input> field with the info which is otherwiseappended; 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=,fields et="

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/...ext_watchcause
Reply With Quote
  #2 (permalink)  
Old 03-22-2008
Nilesh Govindrajan
 
Posts: n/a
Default Re: problem with sessions config.

N . Boatswain wrote:
> 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_ha

ndler = 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 empt
y 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=,fields et="
>
> 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/...ext_watchcause


It works for me; I am using php-5.2.5 with lighttpd and FastCGI.

I called session_start() on both the pages.

and

I have enabled session.use_trans_sid.

You can temporarily override it from the php script by using this -
<?
//...other code
ini_set("session.use_trans_sid",1);
//...other code
?>

Try and report again.
Reply With Quote
  #3 (permalink)  
Old 03-23-2008
N . Boatswain
 
Posts: n/a
Default RE: [PHP] Re: problem with sessions config.


Thanks for your answers people; but i'm still having the problem, ¿any approach to the reason?. Remember everything works fine in on-line servers, so it may not be a problem of the code, but a config. one;cheers,
Nicolas.


> To: php-general@lists.php.net
> Date: Sat, 22 Mar 2008 13:58:15 +0530
> From: admin@itech7.com
> Subject: [php] Re: problem with sessions config.
>
> N . Boatswain wrote:
> > 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 onmy 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_ha

> ndler = 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 datawill 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 tobe; 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 empt
> y 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 (160bits)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=,fields et="
> >
> > 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

>
> It works for me; I am using php-5.2.5 with lighttpd and FastCGI.
>
> I called session_start() on both the pages.
>
> and
>
> I have enabled session.use_trans_sid.
>
> You can temporarily override it from the php script by using this -
> <?
> //...other code
> ini_set("session.use_trans_sid",1);
> //...other code
> ?>
>
> Try and report again.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


__________________________________________________ _______________
In a rush? Get real-time answers with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_realtime_0 42008
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:06 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0