[PHP] Session troubles
I asked this on php-install list, but got no response so here goes... I simply cannot get session to work correctly. Here's the test script: include("incl.php"); session_start(); $mine++; session_register("mine"); echo $mine; incl.php includes code to save/retrieve session information to/from DB. It calles session_set_save_handler at the end. What happens is I get an error because it is trying to read the variable out and I get a DB error, but my session writing routine is never called...I know, because I have a print in there. And of course, the var doesn't increment upon refreshes - it remains 1. I've seen this before, and it was fixed, but I forget how it was done, as I didn't actually implement the solution (I hear and I forget, I do and I remember, I guess). About my system: FreeBSD 4.4 Apache 1.3.20 PHP 4.0.6 Any and all help appreciated. -- Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome A billion hours ago, human life appeared on earth. A billion minutes ago, Christianty emerged. A billion Coca-Colas ago was yesterday morning. -1996 Coca-Cola Company annual report Management QOTD:No one doubts that we should right size and analyze progress on the market forces. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] session troubles
Hi all, Im new to this mailing list so im not sure what to expect from 'y'all' but i'm hoping this will be the beginning of a long and beautiful friendship. My question: i have a series of PHP4 pages that if I start a session (session_start()) on the first page (adminLogin.php), all is fine and dandy...all the session_resources get passed to the next page (login2.php) and i can get acccess to those session resources. Te problem is, at the top of the page a warning message is displayed: Warning: Cannot send session cache limiter - headers already sent (output started at /home/e-smith/files/ibays/test/html/login2.php:1) in /home/e-smith/files/ibays/test/html/login2.php on line 1 What does this mean?? If i comment out the "session_start()" line, i dodnt get this message BUT i also dont get the session variuables i need. Hope Im making some sense, Hope someone can help. Thanks, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session troubles
Sean, What's going on in incl.php. Are you issuing a session_start()? What if it's rearranged like so, as I understand you have to register the session variable before using it. include("incl.php"); session_start(); session_register("mine"); $mine++; echo $mine; There's the divide and conquer approach too. What do you see if you comment out the include, then issue a phpinfo() and a die()? HTH and Merry Christmas / Happy New Year - Miles Thompson On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote: > I asked this on php-install list, but got no response so here goes... > > I simply cannot get session to work correctly. Here's the test script: > > include("incl.php"); > session_start(); > $mine++; > session_register("mine"); > echo $mine; > > incl.php includes code to save/retrieve session information to/from DB. It > calles session_set_save_handler at the end. > > What happens is I get an error because it is trying to read the variable > out and I get a DB error, but my session writing routine is never > called...I know, because I have a print in there. And of course, the var > doesn't increment upon refreshes - it remains 1. > > I've seen this before, and it was fixed, but I forget how it was done, as I > didn't actually implement the solution (I hear and I forget, I do and I > remember, I guess). About my system: > > FreeBSD 4.4 > Apache 1.3.20 > PHP 4.0.6 > > Any and all help appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session troubles
On 12-29 09:59, Miles Thompson wrote: > Sean, > > What's going on in incl.php. Are you issuing a session_start()? No, I was not. > What if it's rearranged like so, as I understand you have to register the session >variable > before using it. > > include("incl.php"); > session_start(); > session_register("mine"); > $mine++; > echo $mine; No dice, either. Actually, I had tried several permutations of the order before posting. :) > > There's the divide and conquer approach too. What do you see if you comment out the >include, > then issue a phpinfo() and a die()? Okay, I tried commenting out include, resulting in this code: session_start(); session_register("i"); $i++; echo $i; When I run the above, I get this: Fatal error: Failed to initialize session module in /usr/local/apache/htdocs/sesstest.php on line 6 Which is getting somewhere, in a way. Line 6 is session_start(); What part from phpinfo() output were you interested in? Or did you want to see all of it? Thanks for the help. > > HTH and Merry Christmas / Happy New Year - Miles Thompson > > On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote: > > I asked this on php-install list, but got no response so here goes... > > > > I simply cannot get session to work correctly. Here's the test script: > > > > include("incl.php"); > > session_start(); > > $mine++; > > session_register("mine"); > > echo $mine; > > > > incl.php includes code to save/retrieve session information to/from DB. It > > calles session_set_save_handler at the end. > > > > What happens is I get an error because it is trying to read the variable > > out and I get a DB error, but my session writing routine is never > > called...I know, because I have a print in there. And of course, the var > > doesn't increment upon refreshes - it remains 1. > > > > I've seen this before, and it was fixed, but I forget how it was done, as I > > didn't actually implement the solution (I hear and I forget, I do and I > > remember, I guess). About my system: > > > > FreeBSD 4.4 > > Apache 1.3.20 > > PHP 4.0.6 > > > > Any and all help appreciated. -- Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome One learns to itch where one can scratch. -Ernest Bramah Management QOTD:Get hopping on the domain expertise!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session troubles
Sean -- Don't know if this help but here's what I just worked for me. What ver. of PHP are you using? It seem to me that 3.x.x needs PHPLIB: http://sourceforge.net/projects/phplib to handle sessions? -- David Jackson --- sean.php --- --- seaninc.php -- > On 12-29 09:59, Miles Thompson wrote: >> Sean, >> >> What's going on in incl.php. Are you issuing a session_start()? > > No, I was not. > >> What if it's rearranged like so, as I understand you have to register >> the session variable before using it. >> >> include("incl.php"); >> session_start(); >> session_register("mine"); >> $mine++; >> echo $mine; > > No dice, either. Actually, I had tried several permutations of the > order before posting. :) > >> >> There's the divide and conquer approach too. What do you see if you >> comment out the include, then issue a phpinfo() and a die()? > > Okay, I tried commenting out include, resulting in this code: > > session_start(); > session_register("i"); > $i++; > echo $i; > > When I run the above, I get this: > Fatal error: Failed to initialize session module in > /usr/local/apache/htdocs/sesstest.php on line 6 > > Which is getting somewhere, in a way. Line 6 is session_start(); > > What part from phpinfo() output were you interested in? Or did you want > to see all of it? > > Thanks for the help. > >> >> HTH and Merry Christmas / Happy New Year - Miles Thompson >> >> On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote: >> > I asked this on php-install list, but got no response so here >> > goes... >> > >> > I simply cannot get session to work correctly. Here's the test >> > script: >> > >> > include("incl.php"); >> > session_start(); >> > $mine++; >> > session_register("mine"); >> > echo $mine; >> > >> > incl.php includes code to save/retrieve session information to/from >> > DB. It calles session_set_save_handler at the end. >> > >> > What happens is I get an error because it is trying to read the >> > variable out and I get a DB error, but my session writing routine is >> > never called...I know, because I have a print in there. And of >> > course, the var doesn't increment upon refreshes - it remains 1. >> > >> > I've seen this before, and it was fixed, but I forget how it was >> > done, as I didn't actually implement the solution (I hear and I >> > forget, I do and I remember, I guess). About my system: >> > >> > FreeBSD 4.4 >> > Apache 1.3.20 >> > PHP 4.0.6 >> > >> > Any and all help appreciated. > > -- > Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome > ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome > One learns to itch where one can scratch. > -Ernest Bramah > Management QOTD:Get hopping on the domain expertise!! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session troubles
On 12-29 12:56, David Jackson wrote: > Sean -- > Don't know if this help but here's what I just worked for me. > What ver. of PHP are you using? It seem to me that 3.x.x needs > PHPLIB: http://sourceforge.net/projects/phplib > to handle sessions? -- David Jackson > > --- sean.php --- > > > --- seaninc.php -- > session_start(); > session_register("i"); > $i++; > echo $i; > ?> I'm using 4.0.6. I believe session handling was added as part of standard 4.x, right (if configured to compile it)? Some more info: I tried with Konqueror, as I know a cookie needs to be sent during the session_start() phase - I did get a dialog pop-up asking if I wanted to accept the cookie, but I still got the error: Fatal error: Failed to initialize session module in /usr/local/apache/htdocs/sesstest.php on line 2 It says line 2 because I deleted some white space and commented out code thas was before session_start(). I set logging errors on, and sent it to syslog. Here's what it says: Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize session module in /usr/local/apache/htdocs/sesstest.php on line 2 Dec 29 12:12:57 free httpd: PHP Warning: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 But /tmp exists, and is world writeable: free# ls -ld /tmp drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp > > On 12-29 09:59, Miles Thompson wrote: > >> Sean, > >> > >> What's going on in incl.php. Are you issuing a session_start()? > > > > No, I was not. > > > >> What if it's rearranged like so, as I understand you have to register > >> the session variable before using it. > >> > >> include("incl.php"); > >> session_start(); > >> session_register("mine"); > >> $mine++; > >> echo $mine; > > > > No dice, either. Actually, I had tried several permutations of the > > order before posting. :) > > > >> > >> There's the divide and conquer approach too. What do you see if you > >> comment out the include, then issue a phpinfo() and a die()? > > > > Okay, I tried commenting out include, resulting in this code: > > > > session_start(); > > session_register("i"); > > $i++; > > echo $i; > > > > When I run the above, I get this: > > Fatal error: Failed to initialize session module in > > /usr/local/apache/htdocs/sesstest.php on line 6 > > > > Which is getting somewhere, in a way. Line 6 is session_start(); > > > > What part from phpinfo() output were you interested in? Or did you want > > to see all of it? > > > > Thanks for the help. > > > >> > >> HTH and Merry Christmas / Happy New Year - Miles Thompson > >> > >> On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote: > >> > I asked this on php-install list, but got no response so here > >> > goes... > >> > > >> > I simply cannot get session to work correctly. Here's the test > >> > script: > >> > > >> > include("incl.php"); > >> > session_start(); > >> > $mine++; > >> > session_register("mine"); > >> > echo $mine; > >> > > >> > incl.php includes code to save/retrieve session information to/from > >> > DB. It calles session_set_save_handler at the end. > >> > > >> > What happens is I get an error because it is trying to read the > >> > variable out and I get a DB error, but my session writing routine is > >> > never called...I know, because I have a print in there. And of > >> > course, the var doesn't increment upon refreshes - it remains 1. > >> > > >> > I've seen this before, and it was fixed, but I forget how it was > >> > done, as I didn't actually implement the solution (I hear and I > >> > forget, I do and I remember, I guess). About my system: > >> > > >> > FreeBSD 4.4 > >> > Apache 1.3.20 > >> > PHP 4.0.6 > >> > > >> > Any and all help appreciated. > > > > -- > > Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome > > ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome > > One learns to itch where one can scratch. > > -Ernest Bramah > > Management QOTD:Get hopping on the domain expertise!! > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: > > [EMAIL PROTECTED] > > > -- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome In most countries selling harmful things like drugs is punishable. Then howcome people can sell Microsoft software and go unpunished? -Hasse Skrifvars Management QOTD:Work out a solution that fits with problem management!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE
Re: [PHP] Session troubles
Sean -- Do you get the same errors, with Netscape 4.x? > On 12-29 12:56, David Jackson wrote: >> Sean -- >> Don't know if this help but here's what I just worked for me. >> What ver. of PHP are you using? It seem to me that 3.x.x needs >> PHPLIB: http://sourceforge.net/projects/phplib >> to handle sessions? -- David Jackson >> >> --- sean.php --- >> >> >> --- seaninc.php -- >> > session_start(); >> session_register("i"); >> $i++; >> echo $i; >> ?> > > I'm using 4.0.6. I believe session handling was added as part of > standard 4.x, right (if configured to compile it)? > > Some more info: I tried with Konqueror, as I know a cookie needs to be > sent during the session_start() phase - I did get a dialog pop-up > asking if I wanted to accept the cookie, but I still got the error: > > Fatal error: Failed to initialize session module in > /usr/local/apache/htdocs/sesstest.php on line 2 > > It says line 2 because I deleted some white space and commented out > code thas was before session_start(). > > I set logging errors on, and sent it to syslog. Here's what it says: > Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize > session module in /usr/local/apache/htdocs/sesstest.php on line 2 > Dec 29 12:12:57 free httpd: PHP Warning: Failed to write session data > (user). Please verify that the current setting of session.save_path is > correct (/tmp) in Unknown on line 0 > > But /tmp exists, and is world writeable: > > free# ls -ld /tmp > drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp > >> > On 12-29 09:59, Miles Thompson wrote: >> >> Sean, >> >> >> >> What's going on in incl.php. Are you issuing a session_start()? >> > >> > No, I was not. >> > >> >> What if it's rearranged like so, as I understand you have to >> >> register the session variable before using it. >> >> >> >> include("incl.php"); >> >> session_start(); >> >> session_register("mine"); >> >> $mine++; >> >> echo $mine; >> > >> > No dice, either. Actually, I had tried several permutations of the >> > order before posting. :) >> > >> >> >> >> There's the divide and conquer approach too. What do you see if >> >> you comment out the include, then issue a phpinfo() and a die()? >> > >> > Okay, I tried commenting out include, resulting in this code: >> > >> > session_start(); >> > session_register("i"); >> > $i++; >> > echo $i; >> > >> > When I run the above, I get this: >> > Fatal error: Failed to initialize session module in >> > /usr/local/apache/htdocs/sesstest.php on line 6 >> > >> > Which is getting somewhere, in a way. Line 6 is session_start(); >> > >> > What part from phpinfo() output were you interested in? Or did you >> > want to see all of it? >> > >> > Thanks for the help. >> > >> >> >> >> HTH and Merry Christmas / Happy New Year - Miles Thompson >> >> >> >> On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote: >> >> > I asked this on php-install list, but got no response so here >> >> > goes... >> >> > >> >> > I simply cannot get session to work correctly. Here's the test >> >> > script: >> >> > >> >> > include("incl.php"); >> >> > session_start(); >> >> > $mine++; >> >> > session_register("mine"); >> >> > echo $mine; >> >> > >> >> > incl.php includes code to save/retrieve session information >> >> > to/from DB. It calles session_set_save_handler at the end. >> >> > >> >> > What happens is I get an error because it is trying to read the >> >> > variable out and I get a DB error, but my session writing routine >> >> > is never called...I know, because I have a print in there. And of >> >> > course, the var doesn't increment upon refreshes - it remains 1. >> >> > >> >> > I've seen this before, and it was fixed, but I forget how it was >> >> > done, as I didn't actually implement the solution (I hear and I >> >> > forget, I do and I remember, I guess). About my system: >> >> > >> >> > FreeBSD 4.4 >> >> > Apache 1.3.20 >> >> > PHP 4.0.6 >> >> > >> >> > Any and all help appreciated. >> > >> > -- >> > Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome >> > ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome >> > One learns to itch where one can scratch. >> > -Ernest Bramah >> > Management QOTD:Get hopping on the domain expertise!! >> > >> > >> > -- >> > PHP General Mailing List (http://www.php.net/) >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] To >> > contact the list administrators, e-mail: >> > [EMAIL PROTECTED] >> >> >> -- >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> To contact the list administrators, e-mail: >> [EMAIL PROTECTED] > > -- > Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome > ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome > In most countries selling harmful things like drugs is punishable. Then > howcome people can sell Microsoft software and go unpu
Re: [PHP] Session troubles
On 12-29 15:10, David Jackson wrote: > Sean -- > Do you get the same errors, with Netscape 4.x? Yep. The very same. I've tried Galeon, Mozilla, Netscape 4.x, and Konqueror. They all result in the same error. > > On 12-29 12:56, David Jackson wrote: > >> Sean -- > >> Don't know if this help but here's what I just worked for me. > >> What ver. of PHP are you using? It seem to me that 3.x.x needs > >> PHPLIB: http://sourceforge.net/projects/phplib > >> to handle sessions? -- David Jackson > >> > >> --- sean.php --- > >> > >> > >> --- seaninc.php -- > >> >> session_start(); > >> session_register("i"); > >> $i++; > >> echo $i; > >> ?> > > > > I'm using 4.0.6. I believe session handling was added as part of > > standard 4.x, right (if configured to compile it)? > > > > Some more info: I tried with Konqueror, as I know a cookie needs to be > > sent during the session_start() phase - I did get a dialog pop-up > > asking if I wanted to accept the cookie, but I still got the error: > > > > Fatal error: Failed to initialize session module in > > /usr/local/apache/htdocs/sesstest.php on line 2 > > > > It says line 2 because I deleted some white space and commented out > > code thas was before session_start(). > > > > I set logging errors on, and sent it to syslog. Here's what it says: > > Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize > > session module in /usr/local/apache/htdocs/sesstest.php on line 2 > > Dec 29 12:12:57 free httpd: PHP Warning: Failed to write session data > > (user). Please verify that the current setting of session.save_path is > > correct (/tmp) in Unknown on line 0 > > > > But /tmp exists, and is world writeable: > > > > free# ls -ld /tmp > > drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp > > > >> > On 12-29 09:59, Miles Thompson wrote: > >> >> Sean, > >> >> > >> >> What's going on in incl.php. Are you issuing a session_start()? > >> > > >> > No, I was not. > >> > > >> >> What if it's rearranged like so, as I understand you have to > >> >> register the session variable before using it. > >> >> > >> >> include("incl.php"); > >> >> session_start(); > >> >> session_register("mine"); > >> >> $mine++; > >> >> echo $mine; > >> > > >> > No dice, either. Actually, I had tried several permutations of the > >> > order before posting. :) > >> > > >> >> > >> >> There's the divide and conquer approach too. What do you see if > >> >> you comment out the include, then issue a phpinfo() and a die()? > >> > > >> > Okay, I tried commenting out include, resulting in this code: > >> > > >> > session_start(); > >> > session_register("i"); > >> > $i++; > >> > echo $i; > >> > > >> > When I run the above, I get this: > >> > Fatal error: Failed to initialize session module in > >> > /usr/local/apache/htdocs/sesstest.php on line 6 > >> > > >> > Which is getting somewhere, in a way. Line 6 is session_start(); > >> > > >> > What part from phpinfo() output were you interested in? Or did you > >> > want to see all of it? > >> > > >> > Thanks for the help. > >> > > >> >> > >> >> HTH and Merry Christmas / Happy New Year - Miles Thompson > >> >> > >> >> On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote: > >> >> > I asked this on php-install list, but got no response so here > >> >> > goes... > >> >> > > >> >> > I simply cannot get session to work correctly. Here's the test > >> >> > script: > >> >> > > >> >> > include("incl.php"); > >> >> > session_start(); > >> >> > $mine++; > >> >> > session_register("mine"); > >> >> > echo $mine; > >> >> > > >> >> > incl.php includes code to save/retrieve session information > >> >> > to/from DB. It calles session_set_save_handler at the end. > >> >> > > >> >> > What happens is I get an error because it is trying to read the > >> >> > variable out and I get a DB error, but my session writing routine > >> >> > is never called...I know, because I have a print in there. And of > >> >> > course, the var doesn't increment upon refreshes - it remains 1. > >> >> > > >> >> > I've seen this before, and it was fixed, but I forget how it was > >> >> > done, as I didn't actually implement the solution (I hear and I > >> >> > forget, I do and I remember, I guess). About my system: > >> >> > > >> >> > FreeBSD 4.4 > >> >> > Apache 1.3.20 > >> >> > PHP 4.0.6 > >> >> > > >> >> > Any and all help appreciated. > >> > > >> > -- > >> > Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome > >> > ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome > >> > One learns to itch where one can scratch. > >> > -Ernest Bramah > >> > Management QOTD:Get hopping on the domain expertise!! > >> > > >> > > >> > -- > >> > PHP General Mailing List (http://www.php.net/) > >> > To unsubscribe, e-mail: [EMAIL PROTECTED] > >> > For additional commands, e-mail: [EMAIL PROTECTED] To > >> > contact the list administrators, e-mail: > >> > [EMAIL PROTECTED] > >> > >> > >> -- > >> > >> > >> > >> -- > >> PHP General Mailing List (http://www.
Re: [PHP] Session troubles
Sean -- Give the attached scripts a shot, a post the results. Note: Xitami(server+WinMe) + IE5.5 or Mozilla 9.7 works fine but with Netscape-4.9 it returns var names? But when served from Unix/Linux and Apache all 3 work as expected !! Anywhy give them shot. -- David --- form.html --- http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> No title --- form.php $Green"; echo "$Yellow"; echo "$Red"; echo "Verify that session_vars were passwd"; // Get out of here ?> --- form02.php - "; echo ""; echo "session_registers:"; echo "Green:$Green"; echo "Yellow:$Yellow"; echo "Red:$Red"; echo ""; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session troubles
On 12-29 16:46, David Jackson wrote: > Sean -- > > Give the attached scripts a shot, a post the results. > > Note: Xitami(server+WinMe) + IE5.5 or Mozilla 9.7 works > fine but with Netscape-4.9 it returns var names? But > when served from Unix/Linux and Apache all 3 work as expected !! > > Anywhy give them shot. -- David I created and ran these. After hitting submit on form.html, I get this: Fatal error: Failed to initialize session module in /usr/local/apache/htdocs/form.php on line 3 > > --- form.html --- > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml";> > > > No title > > > > > > > > > > > > > > > > --- form.php > > // sessions on 48 N. Random Rd. > session_start(); > session_register('Green'); > session_register('Yellow'); > session_register('Red'); > $Green = $stuff; > $Yellow = $more_stuff; > $Red = $still_more_stuff; > > // basic echo of var from form > echo "We've just echoed var from form\n"; > echo "$Green"; > echo "$Yellow"; > echo "$Red"; > echo "Verify that session_vars were > passwd"; > // Get out of here > > ?> > > --- form02.php - > session_start(); > // sessions on 48 N. Random Rd. > // basic echo of var from form > echo ""; > echo ""; > echo "session_registers:"; > echo "Green:$Green"; > echo "Yellow:$Yellow"; > echo "Red:$Red"; > echo ""; > ?> > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome One lives in the hope of becoming a memory. -Antonio Porchia Management QOTD:I am very concerned that we may not give a dog and pony show and examine where the rubber meets the road on the deliverables, etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session troubles
Sean -- Does you standard (non session) seem to work ok? Such as: $stuff"; echo "$more_stuff"; echo "$still_more_stuff"; ?> Did you compile Apache and PHP from source? If so could you provide me with the ./configure --options you used? This is sound like a config/compile problem to me. You might also want to cross-post to linux-admin mail list? -- David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session troubles
On 12-29 22:27, David Jackson wrote: > Sean -- > > Does you standard (non session) seem to work ok? Such as: > // basic echo of var from form > echo "We've just echoed var from form\n"; > echo "$stuff"; > echo "$more_stuff"; > echo "$still_more_stuff"; > ?> Yes, this works fine. I should have said that before... > Did you compile Apache and PHP from source? If so > could you provide me with the ./configure --options you used? > This is sound like a config/compile problem to me. This is what phpinfo() reports for PHP: './configure' '--with-apxs=/usr/local/sbin/apxs' '--with-config-file-path=/usr/local/etc' '--enable-versioning' '--with-system-regex' '--disable-debug' '--enable-track-vars' '--without-gd' '--without-mysql' '--enable-session' '--with-zlib' '--with-mysql=/usr/local' '--with-pgsql=/usr/local' '--with-openssl=/usr' '--with-session' '--prefix=/usr/local' 'i386--freebsd4.4' I built PHP from the FreeBSD ports collection. When I ran make, in the menu that comes up, I selected "transparent session", among other options. As for Apache...I forget how I installed it. It doesn't appear that I built it from the ports section, so it was either via a package or a tarball - so I'm doing it from ports right now to be sure. We'll see how that goes. > You might also want to cross-post to linux-admin mail list? I'm using FreeBSD. :) I may post to one of the FreeBSD lists eventually, but they can sometimes get irritatable when it's not on-topic... -- Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome We are born to action; and whatever is capable of suggesting and guiding action has power over us from the first. -Charles Horton Cooley Management QOTD:It's an orthogonal issue to identify the core product families and staff appropriately for the process innovation, etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Session troubles
Sean, From your php error_log, it's saying the following: Failed to write session data (user) which sounds like it's having problems writing to the user-defined session handler. Are you using a user-defined session handler? If not, make sure your php.ini file has: session.save_handler = files And *NOT*: session.save_handler = user That will make a big difference. Jaime Bozza -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 29, 2001 1:21 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Session troubles On 12-29 12:56, David Jackson wrote: > Sean -- > Don't know if this help but here's what I just worked for me. What > ver. of PHP are you using? It seem to me that 3.x.x needs > PHPLIB: http://sourceforge.net/projects/phplib > to handle sessions? -- David Jackson > > --- sean.php --- > > > --- seaninc.php -- > session_start(); > session_register("i"); > $i++; > echo $i; > ?> I'm using 4.0.6. I believe session handling was added as part of standard 4.x, right (if configured to compile it)? Some more info: I tried with Konqueror, as I know a cookie needs to be sent during the session_start() phase - I did get a dialog pop-up asking if I wanted to accept the cookie, but I still got the error: Fatal error: Failed to initialize session module in /usr/local/apache/htdocs/sesstest.php on line 2 It says line 2 because I deleted some white space and commented out code thas was before session_start(). I set logging errors on, and sent it to syslog. Here's what it says: Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize session module in /usr/local/apache/htdocs/sesstest.php on line 2 Dec 29 12:12:57 free httpd: PHP Warning: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 But /tmp exists, and is world writeable: free# ls -ld /tmp drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp > > On 12-29 09:59, Miles Thompson wrote: > >> Sean, > >> > >> What's going on in incl.php. Are you issuing a session_start()? > > > > No, I was not. > > > >> What if it's rearranged like so, as I understand you have to > >> register the session variable before using it. > >> > >> include("incl.php"); > >> session_start(); > >> session_register("mine"); > >> $mine++; > >> echo $mine; > > > > No dice, either. Actually, I had tried several permutations of the > > order before posting. :) > > > >> > >> There's the divide and conquer approach too. What do you see if > >> you comment out the include, then issue a phpinfo() and a die()? > > > > Okay, I tried commenting out include, resulting in this code: > > > > session_start(); > > session_register("i"); > > $i++; > > echo $i; > > > > When I run the above, I get this: > > Fatal error: Failed to initialize session module in > > /usr/local/apache/htdocs/sesstest.php on line 6 > > > > Which is getting somewhere, in a way. Line 6 is session_start(); > > > > What part from phpinfo() output were you interested in? Or did you > > want to see all of it? > > > > Thanks for the help. > > > >> > >> HTH and Merry Christmas / Happy New Year - Miles Thompson > >> > >> On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote: > >> > I asked this on php-install list, but got no response so here > >> > goes... > >> > > >> > I simply cannot get session to work correctly. Here's the test > >> > script: > >> > > >> > include("incl.php"); > >> > session_start(); > >> > $mine++; > >> > session_register("mine"); > >> > echo $mine; > >> > > >> > incl.php includes code to save/retrieve session information > >> > to/from DB. It calles session_set_save_handler at the end. > >> > > >> > What happens is I get an error because it is trying to read the > >> > variable out and I get a DB error, but my session writing routine > >> > is never called...I know, because I have a print in there. And of > >> > course, the var doesn't increment upon refreshes - it remains 1. > >> > > >> > I've seen this before, and it was fixed, but I forget how it was > >> > done, as I didn't actually implement the solution (I hear and I > >> > forget, I
Re: [PHP] Session troubles
On 12-31 09:23, Jaime Bozza wrote: > Sean, > From your php error_log, it's saying the following: > Failed to write session data (user) > > which sounds like it's having problems writing to the user-defined > session handler. Are you using a user-defined session handler? If not, > make sure your php.ini file has: > > session.save_handler = files > > And *NOT*: > session.save_handler = user > > That will make a big difference. Good eye. That was it. I *did* have it as "user" because I was trying to do my own user-defined session handler, and then stepped back and was just trying to get the simpler case to work, w/o changing it back. Thanks, it works now! Now, I just need to see if I can get my session_handler working... It's too bad the error message isn't more descriptive for this, BTW... > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 29, 2001 1:21 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-29 12:56, David Jackson wrote: > > Sean -- > > Don't know if this help but here's what I just worked for me. What > > ver. of PHP are you using? It seem to me that 3.x.x needs > > PHPLIB: http://sourceforge.net/projects/phplib > > to handle sessions? -- David Jackson > > > > --- sean.php --- > > > > > > --- seaninc.php -- > > > session_start(); > > session_register("i"); > > $i++; > > echo $i; > > ?> > > I'm using 4.0.6. I believe session handling was added as part of > standard 4.x, right (if configured to compile it)? > > Some more info: I tried with Konqueror, as I know a cookie needs to be > sent during the session_start() phase - I did get a dialog pop-up asking > if I wanted to accept the cookie, but I still got the error: > > Fatal error: Failed to initialize session module in > /usr/local/apache/htdocs/sesstest.php on line 2 > > It says line 2 because I deleted some white space and commented out code > thas was before session_start(). > > I set logging errors on, and sent it to syslog. Here's what it says: Dec > 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize session > module in /usr/local/apache/htdocs/sesstest.php on line 2 Dec 29 > 12:12:57 free httpd: PHP Warning: Failed to write session data (user). > Please verify that the current setting of session.save_path is correct > (/tmp) in Unknown on line 0 > > But /tmp exists, and is world writeable: > > free# ls -ld /tmp > drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp > > > > On 12-29 09:59, Miles Thompson wrote: > > >> Sean, > > >> > > >> What's going on in incl.php. Are you issuing a session_start()? > > > > > > No, I was not. > > > > > >> What if it's rearranged like so, as I understand you have to > > >> register the session variable before using it. > > >> > > >> include("incl.php"); > > >> session_start(); > > >> session_register("mine"); > > >> $mine++; > > >> echo $mine; > > > > > > No dice, either. Actually, I had tried several permutations of the > > > order before posting. :) > > > > > >> > > >> There's the divide and conquer approach too. What do you see if > > >> you comment out the include, then issue a phpinfo() and a die()? > > > > > > Okay, I tried commenting out include, resulting in this code: > > > > > > session_start(); > > > session_register("i"); > > > $i++; > > > echo $i; > > > > > > When I run the above, I get this: > > > Fatal error: Failed to initialize session module in > > > /usr/local/apache/htdocs/sesstest.php on line 6 > > > > > > Which is getting somewhere, in a way. Line 6 is session_start(); > > > > > > What part from phpinfo() output were you interested in? Or did you > > > want to see all of it? > > > > > > Thanks for the help. > > > > > >> > > >> HTH and Merry Christmas / Happy New Year - Miles Thompson > > >> > > >> On Friday 28 December 2001 11:26 pm, Sean LeBlanc wrote: > > >> > I asked this on php-install list, but got no response so here > > >> > goes... > > >> > > > >> > I simply cannot get session to work correctly. Here's the test > > >> > script: >
RE: [PHP] Session troubles
I agree. Perhaps make a feature request that disallows session starting if save_handler=user and you haven't defined a session handler?Then it could spit out a more correct error message. Jaime Bozza -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 01, 2002 8:32 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Session troubles On 12-31 09:23, Jaime Bozza wrote: > Sean, > From your php error_log, it's saying the following: > Failed to write session data (user) > > which sounds like it's having problems writing to the user-defined > session handler. Are you using a user-defined session handler? If > not, make sure your php.ini file has: > > session.save_handler = files > > And *NOT*: > session.save_handler = user > > That will make a big difference. Good eye. That was it. I *did* have it as "user" because I was trying to do my own user-defined session handler, and then stepped back and was just trying to get the simpler case to work, w/o changing it back. Thanks, it works now! Now, I just need to see if I can get my session_handler working... It's too bad the error message isn't more descriptive for this, BTW... > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 29, 2001 1:21 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-29 12:56, David Jackson wrote: > > Sean -- > > Don't know if this help but here's what I just worked for me. What > > ver. of PHP are you using? It seem to me that 3.x.x needs > > PHPLIB: http://sourceforge.net/projects/phplib > > to handle sessions? -- David Jackson > > > > --- sean.php --- > > > > > > --- seaninc.php -- > > > session_start(); > > session_register("i"); > > $i++; > > echo $i; > > ?> > > I'm using 4.0.6. I believe session handling was added as part of > standard 4.x, right (if configured to compile it)? > > Some more info: I tried with Konqueror, as I know a cookie needs to be > sent during the session_start() phase - I did get a dialog pop-up > asking if I wanted to accept the cookie, but I still got the error: > > Fatal error: Failed to initialize session module in > /usr/local/apache/htdocs/sesstest.php on line 2 > > It says line 2 because I deleted some white space and commented out > code thas was before session_start(). > > I set logging errors on, and sent it to syslog. Here's what it says: > Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize > session module in /usr/local/apache/htdocs/sesstest.php on line 2 Dec > 29 12:12:57 free httpd: PHP Warning: Failed to write session data > (user). Please verify that the current setting of session.save_path is > correct > (/tmp) in Unknown on line 0 > > But /tmp exists, and is world writeable: > > free# ls -ld /tmp > drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp > > > > On 12-29 09:59, Miles Thompson wrote: > > >> Sean, > > >> > > >> What's going on in incl.php. Are you issuing a session_start()? > > > > > > No, I was not. > > > > > >> What if it's rearranged like so, as I understand you have to > > >> register the session variable before using it. > > >> > > >> include("incl.php"); > > >> session_start(); > > >> session_register("mine"); > > >> $mine++; > > >> echo $mine; > > > > > > No dice, either. Actually, I had tried several permutations of the > > > order before posting. :) > > > > > >> > > >> There's the divide and conquer approach too. What do you see if > > >> you comment out the include, then issue a phpinfo() and a die()? > > > > > > Okay, I tried commenting out include, resulting in this code: > > > > > > session_start(); > > > session_register("i"); > > > $i++; > > > echo $i; > > > > > > When I run the above, I get this: > > > Fatal error: Failed to initialize session module in > > > /usr/local/apache/htdocs/sesstest.php on line 6 > > > > > > Which is getting somewhere, in a way. Line 6 is session_start(); > > > > > > What part from phpinfo() output were you interested in? Or did you > > > want to see all of it? > > > > > > Thanks for the help. > > > > > >> > > >> HTH and Merry Christmas / Happy
Re: [PHP] Session troubles
On 01-02 07:45, Jaime Bozza wrote: > I agree. Perhaps make a feature request that disallows session starting > if save_handler=user and you haven't defined a session handler?Then > it could spit out a more correct error message. Blast. I am still unable to get my own session handler to work. My session handler's write never gets called; only my session_open and session_read get calledthe default file session handler still works, if I change save_handler back to file instead of user. As for the feature request, I guess I could - is there a mechanism to do this outlined somewhere? > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 01, 2002 8:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-31 09:23, Jaime Bozza wrote: > > Sean, > > From your php error_log, it's saying the following: > > Failed to write session data (user) > > > > which sounds like it's having problems writing to the user-defined > > session handler. Are you using a user-defined session handler? If > > not, make sure your php.ini file has: > > > > session.save_handler = files > > > > And *NOT*: > > session.save_handler = user > > > > That will make a big difference. > > Good eye. That was it. I *did* have it as "user" because I was trying to > do my own user-defined session handler, and then stepped back and was > just trying to get the simpler case to work, w/o changing it back. > > Thanks, it works now! > > Now, I just need to see if I can get my session_handler working... > > It's too bad the error message isn't more descriptive for this, BTW... > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, December 29, 2001 1:21 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Session troubles > > > > > > On 12-29 12:56, David Jackson wrote: > > > Sean -- > > > Don't know if this help but here's what I just worked for me. What > > > ver. of PHP are you using? It seem to me that 3.x.x needs > > > PHPLIB: http://sourceforge.net/projects/phplib > > > to handle sessions? -- David Jackson > > > > > > --- sean.php --- > > > > > > > > > --- seaninc.php -- > > > > > session_start(); > > > session_register("i"); > > > $i++; > > > echo $i; > > > ?> > > > > I'm using 4.0.6. I believe session handling was added as part of > > standard 4.x, right (if configured to compile it)? > > > > Some more info: I tried with Konqueror, as I know a cookie needs to be > > > sent during the session_start() phase - I did get a dialog pop-up > > asking if I wanted to accept the cookie, but I still got the error: > > > > Fatal error: Failed to initialize session module in > > /usr/local/apache/htdocs/sesstest.php on line 2 > > > > It says line 2 because I deleted some white space and commented out > > code thas was before session_start(). > > > > I set logging errors on, and sent it to syslog. Here's what it says: > > Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize > > session module in /usr/local/apache/htdocs/sesstest.php on line 2 Dec > > 29 12:12:57 free httpd: PHP Warning: Failed to write session data > > (user). Please verify that the current setting of session.save_path is > > > correct > > (/tmp) in Unknown on line 0 > > > > But /tmp exists, and is world writeable: > > > > free# ls -ld /tmp > > drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp > > > > > > On 12-29 09:59, Miles Thompson wrote: > > > >> Sean, > > > >> > > > >> What's going on in incl.php. Are you issuing a session_start()? > > > > > > > > No, I was not. > > > > > > > >> What if it's rearranged like so, as I understand you have to > > > >> register the session variable before using it. > > > >> > > > >> include("incl.php"); > > > >> session_start(); > > > >> session_register("mine"); > > > >> $mine++; > > > >> echo $mine; > > > > > > > > No dice, either. Actually, I had tried several permutations of the > > > > order before posting. :) > > > > > > > >> > > > >> There's
RE: [PHP] Session troubles
What do you have for the return values for your session_read function? (Specifically, what do you return when there's no data available?) Jaime Bozza -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 11:20 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Session troubles On 01-02 07:45, Jaime Bozza wrote: > I agree. Perhaps make a feature request that disallows session starting > if save_handler=user and you haven't defined a session handler? Then > it could spit out a more correct error message. Blast. I am still unable to get my own session handler to work. My session handler's write never gets called; only my session_open and session_read get calledthe default file session handler still works, if I change save_handler back to file instead of user. As for the feature request, I guess I could - is there a mechanism to do this outlined somewhere? > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 01, 2002 8:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-31 09:23, Jaime Bozza wrote: > > Sean, > > From your php error_log, it's saying the following: > > Failed to write session data (user) > > > > which sounds like it's having problems writing to the user-defined > > session handler. Are you using a user-defined session handler? If > > not, make sure your php.ini file has: > > > > session.save_handler = files > > > > And *NOT*: > > session.save_handler = user > > > > That will make a big difference. > > Good eye. That was it. I *did* have it as "user" because I was trying > to do my own user-defined session handler, and then stepped back and > was just trying to get the simpler case to work, w/o changing it back. > > Thanks, it works now! > > Now, I just need to see if I can get my session_handler working... > > It's too bad the error message isn't more descriptive for this, BTW... > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, December 29, 2001 1:21 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Session troubles > > > > > > On 12-29 12:56, David Jackson wrote: > > > Sean -- > > > Don't know if this help but here's what I just worked for me. What > > > ver. of PHP are you using? It seem to me that 3.x.x needs > > > PHPLIB: http://sourceforge.net/projects/phplib > > > to handle sessions? -- David Jackson > > > > > > --- sean.php --- > > > > > > > > > --- seaninc.php -- > > > > > session_start(); > > > session_register("i"); > > > $i++; > > > echo $i; > > > ?> > > > > I'm using 4.0.6. I believe session handling was added as part of > > standard 4.x, right (if configured to compile it)? > > > > Some more info: I tried with Konqueror, as I know a cookie needs to > > be > > > sent during the session_start() phase - I did get a dialog pop-up > > asking if I wanted to accept the cookie, but I still got the error: > > > > Fatal error: Failed to initialize session module in > > /usr/local/apache/htdocs/sesstest.php on line 2 > > > > It says line 2 because I deleted some white space and commented out > > code thas was before session_start(). > > > > I set logging errors on, and sent it to syslog. Here's what it says: > > Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize > > session module in /usr/local/apache/htdocs/sesstest.php on line 2 Dec > > 29 12:12:57 free httpd: PHP Warning: Failed to write session data > > (user). Please verify that the current setting of session.save_path is > > > correct > > (/tmp) in Unknown on line 0 > > > > But /tmp exists, and is world writeable: > > > > free# ls -ld /tmp > > drwxrwxrwt 16 root wheel 1024 Dec 29 12:14 /tmp > > > > > > On 12-29 09:59, Miles Thompson wrote: > > > >> Sean, > > > >> > > > >> What's going on in incl.php. Are you issuing a session_start()? > > > > > > > > No, I was not. > > > > > > > >> What if it's rearranged like so, as I understand you have to > > > >> register the session variable before using it. > > > >> > > > >> include("incl.php"); > > > >> session_start(); > >
Re: [PHP] Session troubles
On 01-02 14:31, Jaime Bozza wrote: > What do you have for the return values for your session_read function? > (Specifically, what do you return when there's no data available?) Well, it turns out that write *is* being called, but due to some feature of session write, echo and print don't work, as I read on bugs.php.net. So I put a file-writing mechanism in there and I see it is being called and what was happening. I was trying to do an insert all the time, due to bad logic, so it was cycling to 2, then stopping. Now it seems to work properly. :) As for the session read, I return false when no value is found. > > Jaime Bozza > > > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 02, 2002 11:20 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 01-02 07:45, Jaime Bozza wrote: > > I agree. Perhaps make a feature request that disallows session > starting > > if save_handler=user and you haven't defined a session handler? > Then > > it could spit out a more correct error message. > > Blast. I am still unable to get my own session handler to work. My > session handler's write never gets called; only my session_open and > session_read get calledthe default file session handler still works, > if I change save_handler back to file instead of user. > > As for the feature request, I guess I could - is there a mechanism to do > this outlined somewhere? > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, January 01, 2002 8:32 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Session troubles > > > > > > On 12-31 09:23, Jaime Bozza wrote: > > > Sean, > > > From your php error_log, it's saying the following: > > > Failed to write session data (user) > > > > > > which sounds like it's having problems writing to the user-defined > > > session handler. Are you using a user-defined session handler? If > > > not, make sure your php.ini file has: > > > > > > session.save_handler = files > > > > > > And *NOT*: > > > session.save_handler = user > > > > > > That will make a big difference. > > > > Good eye. That was it. I *did* have it as "user" because I was trying > > to do my own user-defined session handler, and then stepped back and > > was just trying to get the simpler case to work, w/o changing it back. > > > > Thanks, it works now! > > > > Now, I just need to see if I can get my session_handler working... > > > > It's too bad the error message isn't more descriptive for this, BTW... > > > > > > > -Original Message- > > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > > Sent: Saturday, December 29, 2001 1:21 PM > > > To: [EMAIL PROTECTED] > > > Subject: Re: [PHP] Session troubles > > > > > > > > > On 12-29 12:56, David Jackson wrote: > > > > Sean -- > > > > Don't know if this help but here's what I just worked for me. What > > > > > ver. of PHP are you using? It seem to me that 3.x.x needs > > > > PHPLIB: http://sourceforge.net/projects/phplib > > > > to handle sessions? -- David Jackson > > > > > > > > --- sean.php --- > > > > > > > > > > > > --- seaninc.php -- > > > > > > > session_start(); > > > > session_register("i"); > > > > $i++; > > > > echo $i; > > > > ?> > > > > > > I'm using 4.0.6. I believe session handling was added as part of > > > standard 4.x, right (if configured to compile it)? > > > > > > Some more info: I tried with Konqueror, as I know a cookie needs to > > > be > > > > > sent during the session_start() phase - I did get a dialog pop-up > > > asking if I wanted to accept the cookie, but I still got the error: > > > > > > Fatal error: Failed to initialize session module in > > > /usr/local/apache/htdocs/sesstest.php on line 2 > > > > > > It says line 2 because I deleted some white space and commented out > > > code thas was before session_start(). > > > > > > I set logging errors on, and sent it to syslog. Here's what it says: > > > Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize > > > session module in /usr/local/apache/htdocs/ses
RE: [PHP] Session troubles
Returning false is invalid for the session read function, and has caused *MANY* issues with PHP and Sessions. (Check the archives as well as the bugs database. I have a couple in there myself) Change: return false; To: return ''; And things should start working as expected. Jaime Bozza -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 4:02 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Session troubles On 01-02 14:31, Jaime Bozza wrote: > What do you have for the return values for your session_read function? > (Specifically, what do you return when there's no data available?) Well, it turns out that write *is* being called, but due to some feature of session write, echo and print don't work, as I read on bugs.php.net. So I put a file-writing mechanism in there and I see it is being called and what was happening. I was trying to do an insert all the time, due to bad logic, so it was cycling to 2, then stopping. Now it seems to work properly. :) As for the session read, I return false when no value is found. > > Jaime Bozza > > > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 02, 2002 11:20 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 01-02 07:45, Jaime Bozza wrote: > > I agree. Perhaps make a feature request that disallows session > starting > > if save_handler=user and you haven't defined a session handler? > Then > > it could spit out a more correct error message. > > Blast. I am still unable to get my own session handler to work. My > session handler's write never gets called; only my session_open and > session_read get calledthe default file session handler still > works, if I change save_handler back to file instead of user. > > As for the feature request, I guess I could - is there a mechanism to > do this outlined somewhere? > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, January 01, 2002 8:32 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Session troubles > > > > > > On 12-31 09:23, Jaime Bozza wrote: > > > Sean, > > > From your php error_log, it's saying the following: > > > Failed to write session data (user) > > > > > > which sounds like it's having problems writing to the > > > user-defined session handler. Are you using a user-defined > > > session handler? If not, make sure your php.ini file has: > > > > > > session.save_handler = files > > > > > > And *NOT*: > > > session.save_handler = user > > > > > > That will make a big difference. > > > > Good eye. That was it. I *did* have it as "user" because I was > > trying > > to do my own user-defined session handler, and then stepped back and > > was just trying to get the simpler case to work, w/o changing it back. > > > > Thanks, it works now! > > > > Now, I just need to see if I can get my session_handler working... > > > > It's too bad the error message isn't more descriptive for this, > > BTW... > > > > > > > -Original Message- > > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > > Sent: Saturday, December 29, 2001 1:21 PM > > > To: [EMAIL PROTECTED] > > > Subject: Re: [PHP] Session troubles > > > > > > > > > On 12-29 12:56, David Jackson wrote: > > > > Sean -- > > > > Don't know if this help but here's what I just worked for me. > > > > What > > > > > ver. of PHP are you using? It seem to me that 3.x.x needs > > > > PHPLIB: http://sourceforge.net/projects/phplib > > > > to handle sessions? -- David Jackson > > > > > > > > --- sean.php --- > > > > > > > > > > > > --- seaninc.php -- > > > > > > > session_start(); > > > > session_register("i"); > > > > $i++; > > > > echo $i; > > > > ?> > > > > > > I'm using 4.0.6. I believe session handling was added as part of > > > standard 4.x, right (if configured to compile it)? > > > > > > Some more info: I tried with Konqueror, as I know a cookie needs > > > to > > > be > > > > > sent during the session_start() phase - I did get a dialog pop-up > > > asking if I wanted to accept the cookie, but I still got the > &
RE: [PHP] Session troubles
Hi Sean ! I had the same problem... this can be resolved using the function "session_write_close()" at the end of each script you use sessions. It will force PHP to call the write and close function. In some combinations of PHP version, Apache and OS, this problem doesn't happens, but as you, I had this problem too.. :) Put this function in yours PHP scripts and see if now them will work. Here is an exemple of a test script: where is my session functions declareted to use database... session_start(); ?> MySQL Session Management: Second Page " ); print( "SESSION Account: $aAccount" ); $aUser = "Katie"; $aAccount = "2026"; print( "CHANGED User: $aUser" ); print( "CHANGED Account: $aAccount" ); session_write_close(); ?> Cheers, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:20 PM To: [EMAIL PROTECTED] Subject:Re: [PHP] Session troubles On 01-02 07:45, Jaime Bozza wrote: > I agree. Perhaps make a feature request that disallows session starting > if save_handler=user and you haven't defined a session handler?Then > it could spit out a more correct error message. Blast. I am still unable to get my own session handler to work. My session handler's write never gets called; only my session_open and session_read get calledthe default file session handler still works, if I change save_handler back to file instead of user. As for the feature request, I guess I could - is there a mechanism to do this outlined somewhere? > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 01, 2002 8:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-31 09:23, Jaime Bozza wrote: > > Sean, > > From your php error_log, it's saying the following: > > Failed to write session data (user) > > > > which sounds like it's having problems writing to the user-defined > > session handler. Are you using a user-defined session handler? If > > not, make sure your php.ini file has: > > > > session.save_handler = files > > > > And *NOT*: > > session.save_handler = user > > > > That will make a big difference. > > Good eye. That was it. I *did* have it as "user" because I was trying to > do my own user-defined session handler, and then stepped back and was > just trying to get the simpler case to work, w/o changing it back. > > Thanks, it works now! > > Now, I just need to see if I can get my session_handler working... > > It's too bad the error message isn't more descriptive for this, BTW... > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, December 29, 2001 1:21 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Session troubles > > > > > > On 12-29 12:56, David Jackson wrote: > > > Sean -- > > > Don't know if this help but here's what I just worked for me. What > > > ver. of PHP are you using? It seem to me that 3.x.x needs > > > PHPLIB: http://sourceforge.net/projects/phplib > > > to handle sessions? -- David Jackson > > > > > > --- sean.php --- > > > > > > > > > --- seaninc.php -- > > > > > session_start(); > > > session_register("i"); > > > $i++; > > > echo $i; > > > ?> > > > > I'm using 4.0.6. I believe session handling was added as part of > > standard 4.x, right (if configured to compile it)? > > > > Some more info: I tried with Konqueror, as I know a cookie needs to be > > > sent during the session_start() phase - I did get a dialog pop-up > > asking if I wanted to accept the cookie, but I still got the error: > > > > Fatal error: Failed to initialize session module in > > /usr/local/apache/htdocs/sesstest.php on line 2 > > > > It says line 2 because I deleted some white space and commented out > > code thas was before session_start(). > > > > I set logging errors on, and sent it to syslog. Here's what it says: > > Dec 29 12:12:57 free httpd: PHP Fatal error: Failed to initialize > > session module in /usr/local/apache/htdocs/sesstest.php on line 2 Dec > > 29 12:12:57 free httpd: PHP Warning: Failed to write session data >
RE: [PHP] Session troubles
Ricardo, I've had some strange problems with session writing, but they always returned back to the fact that "return false" was being used in the session read function. PHP 4.0.6 wouldn't write out sessions when register_globals was set to off when you were using "return false". PHP 4.1.0 crashes with signal 11 after a bit when using "return false". I've filed a couple of bug reports with the request that this be fixed. I believe a patch is either being worked on or already submitted, but I'm not positive. Sean's problem is that he's using "return false" in his session read function. The session read function should return a blank value ('') and not false when there's no data. This was never clear in the documentation (and complaint I made) but is quite true. Once switching over to using ('') instead of (false), I no longer had problems. Jaime Bozza -Original Message- From: Junior, Ricardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 8:52 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Session troubles Hi Sean ! I had the same problem... this can be resolved using the function "session_write_close()" at the end of each script you use sessions. It will force PHP to call the write and close function. In some combinations of PHP version, Apache and OS, this problem doesn't happens, but as you, I had this problem too.. :) Put this function in yours PHP scripts and see if now them will work. Here is an exemple of a test script: where is my session functions declareted to use database... session_start(); ?> MySQL Session Management: Second Page " ); print( "SESSION Account: $aAccount" ); $aUser = "Katie"; $aAccount = "2026"; print( "CHANGED User: $aUser" ); print( "CHANGED Account: $aAccount" ); session_write_close(); ?> Cheers, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:20 PM To: [EMAIL PROTECTED] Subject:Re: [PHP] Session troubles On 01-02 07:45, Jaime Bozza wrote: > I agree. Perhaps make a feature request that disallows session starting > if save_handler=user and you haven't defined a session handler? Then > it could spit out a more correct error message. Blast. I am still unable to get my own session handler to work. My session handler's write never gets called; only my session_open and session_read get calledthe default file session handler still works, if I change save_handler back to file instead of user. As for the feature request, I guess I could - is there a mechanism to do this outlined somewhere? > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 01, 2002 8:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-31 09:23, Jaime Bozza wrote: > > Sean, > > From your php error_log, it's saying the following: > > Failed to write session data (user) > > > > which sounds like it's having problems writing to the user-defined > > session handler. Are you using a user-defined session handler? If > > not, make sure your php.ini file has: > > > > session.save_handler = files > > > > And *NOT*: > > session.save_handler = user > > > > That will make a big difference. > > Good eye. That was it. I *did* have it as "user" because I was trying > to do my own user-defined session handler, and then stepped back and > was just trying to get the simpler case to work, w/o changing it back. > > Thanks, it works now! > > Now, I just need to see if I can get my session_handler working... > > It's too bad the error message isn't more descriptive for this, BTW... > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, December 29, 2001 1:21 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Session troubles > > > > > > On 12-29 12:56, David Jackson wrote: > > > Sean -- > > > Don't know if this help but here's what I just worked for me. What > > > ver. of PHP are you using? It seem to me that 3.x.x needs > > > PHPLIB: http://sourceforge.net/projects/phplib > > > to handle sessions? -- David Jackson > > > > > > --- sean.php --- > > > > > > > > > --- seaninc.php -- > > > > > session_start(); &g
RE: [PHP] Session troubles
Ok Jaime. I've imagine that he had the same problem that I have had before.. :) I'm really returning a '"" in my read function when there is no data too... because of this I don't had the problem related by Sean... Thanks, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Jaime Bozza [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 11:09 AM To: [EMAIL PROTECTED] Subject:RE: [PHP] Session troubles Ricardo, I've had some strange problems with session writing, but they always returned back to the fact that "return false" was being used in the session read function. PHP 4.0.6 wouldn't write out sessions when register_globals was set to off when you were using "return false". PHP 4.1.0 crashes with signal 11 after a bit when using "return false". I've filed a couple of bug reports with the request that this be fixed. I believe a patch is either being worked on or already submitted, but I'm not positive. Sean's problem is that he's using "return false" in his session read function. The session read function should return a blank value ('') and not false when there's no data. This was never clear in the documentation (and complaint I made) but is quite true. Once switching over to using ('') instead of (false), I no longer had problems. Jaime Bozza -Original Message- From: Junior, Ricardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 8:52 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Session troubles Hi Sean ! I had the same problem... this can be resolved using the function "session_write_close()" at the end of each script you use sessions. It will force PHP to call the write and close function. In some combinations of PHP version, Apache and OS, this problem doesn't happens, but as you, I had this problem too.. :) Put this function in yours PHP scripts and see if now them will work. Here is an exemple of a test script: where is my session functions declareted to use database... session_start(); ?> MySQL Session Management: Second Page " ); print( "SESSION Account: $aAccount" ); $aUser = "Katie"; $aAccount = "2026"; print( "CHANGED User: $aUser" ); print( "CHANGED Account: $aAccount" ); session_write_close(); ?> Cheers, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:20 PM To: [EMAIL PROTECTED] Subject:Re: [PHP] Session troubles On 01-02 07:45, Jaime Bozza wrote: > I agree. Perhaps make a feature request that disallows session starting > if save_handler=user and you haven't defined a session handler? Then > it could spit out a more correct error message. Blast. I am still unable to get my own session handler to work. My session handler's write never gets called; only my session_open and session_read get calledthe default file session handler still works, if I change save_handler back to file instead of user. As for the feature request, I guess I could - is there a mechanism to do this outlined somewhere? > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 01, 2002 8:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-31 09:23, Jaime Bozza wrote: > > Sean, > > From your php error_log, it's saying the following: > > Failed to write session data (user) > > > > which sounds like it's having problems writing to the user-defined > > session handler. Are you using a user-defined session handler? If > > not, make sure your php.ini file has: > > > > session.save_handler = files > > > > And *NOT*: > > session.save_handler = user > > > > That will make a big difference. > > Good eye. That was it. I *did* have it as "user" because I was trying > to do my own user-defined session handler, and then stepped back and > was just trying to get the simpler case to work, w/o changing it back. > > Thanks, it works now! > > Now, I just need to see if I can get my session_handler working... > > It's too bad the error message isn't more descriptive for this, BTW... > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, Decem
RE: [PHP] Session troubles
Hmmm... So, there are yet more problems with the session functions. :) Are you using 4.1.1 or 4.0.6? Jaime -Original Message- From: Junior, Ricardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 9:34 AM To: 'Jaime Bozza'; [EMAIL PROTECTED] Subject: RE: [PHP] Session troubles Ok Jaime. I've imagine that he had the same problem that I have had before.. :) I'm really returning a '"" in my read function when there is no data too... because of this I don't had the problem related by Sean... Thanks, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Jaime Bozza [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 11:09 AM To: [EMAIL PROTECTED] Subject:RE: [PHP] Session troubles Ricardo, I've had some strange problems with session writing, but they always returned back to the fact that "return false" was being used in the session read function. PHP 4.0.6 wouldn't write out sessions when register_globals was set to off when you were using "return false". PHP 4.1.0 crashes with signal 11 after a bit when using "return false". I've filed a couple of bug reports with the request that this be fixed. I believe a patch is either being worked on or already submitted, but I'm not positive. Sean's problem is that he's using "return false" in his session read function. The session read function should return a blank value ('') and not false when there's no data. This was never clear in the documentation (and complaint I made) but is quite true. Once switching over to using ('') instead of (false), I no longer had problems. Jaime Bozza -Original Message----- From: Junior, Ricardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 8:52 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Session troubles Hi Sean ! I had the same problem... this can be resolved using the function "session_write_close()" at the end of each script you use sessions. It will force PHP to call the write and close function. In some combinations of PHP version, Apache and OS, this problem doesn't happens, but as you, I had this problem too.. :) Put this function in yours PHP scripts and see if now them will work. Here is an exemple of a test script: where is my session functions declareted to use database... session_start(); ?> MySQL Session Management: Second Page " ); print( "SESSION Account: $aAccount" ); $aUser = "Katie"; $aAccount = "2026"; print( "CHANGED User: $aUser" ); print( "CHANGED Account: $aAccount" ); session_write_close(); ?> Cheers, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:20 PM To: [EMAIL PROTECTED] Subject:Re: [PHP] Session troubles On 01-02 07:45, Jaime Bozza wrote: > I agree. Perhaps make a feature request that disallows session starting > if save_handler=user and you haven't defined a session handler? Then > it could spit out a more correct error message. Blast. I am still unable to get my own session handler to work. My session handler's write never gets called; only my session_open and session_read get calledthe default file session handler still works, if I change save_handler back to file instead of user. As for the feature request, I guess I could - is there a mechanism to do this outlined somewhere? > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 01, 2002 8:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-31 09:23, Jaime Bozza wrote: > > Sean, > > From your php error_log, it's saying the following: > > Failed to write session data (user) > > > > which sounds like it's having problems writing to the user-defined > > session handler. Are you using a user-defined session handler? If > > not, make sure your php.ini file has: > > > > session.save_handler = files > > > > And *NOT*: > > session.save_handler = user > > > > That will make a big difference. > > Good eye. That was it. I *did* have it as "user" because I was trying > to do my own user-defined session handler, and then stepped back and > was just trying to get the simpler case to work, w/o changing it back. > > Thanks, it works now! >
RE: [PHP] Session troubles
FYI - I can confirm Jaime's assertion. I too had the exact same issue with the exact same fix. > -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]. > net] On Behalf Of Jaime Bozza > Sent: Thursday, January 03, 2002 9:09 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Session troubles > > > Ricardo, >I've had some strange problems with session writing, but > they always returned back to the fact that "return false" was > being used in the session read function. PHP 4.0.6 wouldn't > write out sessions when register_globals was set to off when > you were using "return false". PHP 4.1.0 crashes with signal > 11 after a bit when using "return false". I've filed a couple > of bug reports with the request that this be fixed. I believe > a patch is either being worked on or already submitted, but > I'm not positive. > >Sean's problem is that he's using "return false" in his > session read function. The session read function should > return a blank value ('') and not false when there's no data. > This was never clear in the documentation (and complaint I > made) but is quite true. Once switching over to using ('') > instead of (false), I no longer had problems. > > Jaime Bozza > > > -Original Message- > From: Junior, Ricardo [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 03, 2002 8:52 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Session troubles > > > Hi Sean ! > > I had the same problem... this can be resolved using the > function "session_write_close()" at the end of each script > you use sessions. It will force PHP to call the write and > close function. > > In some combinations of PHP version, Apache and OS, this > problem doesn't happens, but as you, I had this problem too.. :) > > Put this function in yours PHP scripts and see if now them will work. > > Here is an exemple of a test script: > > error_reporting( E_ALL ); > ini_set("session.save_handler","user"); > include( "./mysession.php" ); > where is my session > functions > declareted to use database... > session_start(); > ?> > > > MySQL Session Management: Second Page > > > print( "SESSION User: $aUser" ); > print( "SESSION Account: $aAccount" ); > $aUser = "Katie"; > $aAccount = "2026"; > print( "CHANGED User: $aUser" ); > print( "CHANGED Account: $aAccount" ); > session_write_close(); > ?> > > > > Cheers, > _ > Ricardo J. A. Júnior, Software Engineer Trainee > Bowne Global Solutions > > Phone +55 21 2515 7713 > [EMAIL PROTECTED] > www.bowneglobal.com.br > > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 02, 2002 2:20 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > On 01-02 07:45, Jaime Bozza wrote: > > I agree. Perhaps make a feature request that disallows session > starting > > if save_handler=user and you haven't defined a session handler? > Then > > it could spit out a more correct error message. > > Blast. I am still unable to get my own session handler to > work. My session handler's write never gets called; only my > session_open and session_read get calledthe default file > session handler still works, if I change save_handler back to > file instead of user. > > As for the feature request, I guess I could - is there a > mechanism to do this outlined somewhere? > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, January 01, 2002 8:32 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Session troubles > > > > > > On 12-31 09:23, Jaime Bozza wrote: > > > Sean, > > > From your php error_log, it's saying the following: > > > Failed to write session data (user) > > > > > > which sounds like it's having problems writing to the > user-defined > > > session handler. Are you using a user-defined session > handler? If > > > not, make sure your php.ini file has: > > > > > > session.save_handler = files > > > > > > And *NOT*: > > > session.save_handler = user > > > > > > That will make a big difference. > > > > Good eye. That w
RE: [PHP] Session troubles
I was using 4.06 version... but I don't test this issues with 4.1 version in my system (linux Mandrake 8.1)... I will test and let you know! :) _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Jaime Bozza [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 11:38 AM To: [EMAIL PROTECTED] Subject:RE: [PHP] Session troubles Hmmm... So, there are yet more problems with the session functions. :) Are you using 4.1.1 or 4.0.6? Jaime -Original Message- From: Junior, Ricardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 9:34 AM To: 'Jaime Bozza'; [EMAIL PROTECTED] Subject: RE: [PHP] Session troubles Ok Jaime. I've imagine that he had the same problem that I have had before.. :) I'm really returning a '"" in my read function when there is no data too... because of this I don't had the problem related by Sean... Thanks, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Jaime Bozza [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 11:09 AM To: [EMAIL PROTECTED] Subject:RE: [PHP] Session troubles Ricardo, I've had some strange problems with session writing, but they always returned back to the fact that "return false" was being used in the session read function. PHP 4.0.6 wouldn't write out sessions when register_globals was set to off when you were using "return false". PHP 4.1.0 crashes with signal 11 after a bit when using "return false". I've filed a couple of bug reports with the request that this be fixed. I believe a patch is either being worked on or already submitted, but I'm not positive. Sean's problem is that he's using "return false" in his session read function. The session read function should return a blank value ('') and not false when there's no data. This was never clear in the documentation (and complaint I made) but is quite true. Once switching over to using ('') instead of (false), I no longer had problems. Jaime Bozza -Original Message- From: Junior, Ricardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 8:52 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Session troubles Hi Sean ! I had the same problem... this can be resolved using the function "session_write_close()" at the end of each script you use sessions. It will force PHP to call the write and close function. In some combinations of PHP version, Apache and OS, this problem doesn't happens, but as you, I had this problem too.. :) Put this function in yours PHP scripts and see if now them will work. Here is an exemple of a test script: where is my session functions declareted to use database... session_start(); ?> MySQL Session Management: Second Page " ); print( "SESSION Account: $aAccount" ); $aUser = "Katie"; $aAccount = "2026"; print( "CHANGED User: $aUser" ); print( "CHANGED Account: $aAccount" ); session_write_close(); ?> Cheers, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:20 PM To: [EMAIL PROTECTED] Subject:Re: [PHP] Session troubles On 01-02 07:45, Jaime Bozza wrote: > I agree. Perhaps make a feature request that disallows session starting > if save_handler=user and you haven't defined a session handler? Then > it could spit out a more correct error message. Blast. I am still unable to get my own session handler to work. My session handler's write never gets called; only my session_open and session_read get calledthe default file session handler still works, if I change save_handler back to file instead of user. As for the feature request, I guess I could - is there a mechanism to do this outlined somewhere? > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 01, 2002 8:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > > On 12-31 09:23, Jaime Bozza wrote: > > Sean, > > From your php error_log, it's saying the following: > > Failed to write session data (user) > > > > which sounds like it's having problems writing to the user-defined > > session handler. Are you using a user-defined session handler? If
RE: [PHP] Session troubles
This was problem that I had: the function write was not been called by PHP sessions functions when a script finish or when I change the variable contents. Searching on PHP.net I saw this solution there: add a call to function "session_write_close()" at the end of the php code. This should be another problem with Sessions functions... but I need to test this with PHP 4.1... Thanks, _ Ricardo J. A. Júnior, Software Engineer Trainee Bowne Global Solutions Phone +55 21 2515 7713 [EMAIL PROTECTED] www.bowneglobal.com.br -Original Message- From: Alok K. Dhir [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 12:56 PM To: 'Jaime Bozza'; [EMAIL PROTECTED] Subject: RE: [PHP] Session troubles FYI - I can confirm Jaime's assertion. I too had the exact same issue with the exact same fix. > -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]. > net] On Behalf Of Jaime Bozza > Sent: Thursday, January 03, 2002 9:09 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Session troubles > > > Ricardo, >I've had some strange problems with session writing, but > they always returned back to the fact that "return false" was > being used in the session read function. PHP 4.0.6 wouldn't > write out sessions when register_globals was set to off when > you were using "return false". PHP 4.1.0 crashes with signal > 11 after a bit when using "return false". I've filed a couple > of bug reports with the request that this be fixed. I believe > a patch is either being worked on or already submitted, but > I'm not positive. > >Sean's problem is that he's using "return false" in his > session read function. The session read function should > return a blank value ('') and not false when there's no data. > This was never clear in the documentation (and complaint I > made) but is quite true. Once switching over to using ('') > instead of (false), I no longer had problems. > > Jaime Bozza > > > -Original Message- > From: Junior, Ricardo [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 03, 2002 8:52 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Session troubles > > > Hi Sean ! > > I had the same problem... this can be resolved using the > function "session_write_close()" at the end of each script > you use sessions. It will force PHP to call the write and > close function. > > In some combinations of PHP version, Apache and OS, this > problem doesn't happens, but as you, I had this problem too.. :) > > Put this function in yours PHP scripts and see if now them will work. > > Here is an exemple of a test script: > > error_reporting( E_ALL ); > ini_set("session.save_handler","user"); > include( "./mysession.php" ); > where is my session > functions > declareted to use database... > session_start(); > ?> > > > MySQL Session Management: Second Page > > > print( "SESSION User: $aUser" ); > print( "SESSION Account: $aAccount" ); > $aUser = "Katie"; > $aAccount = "2026"; > print( "CHANGED User: $aUser" ); > print( "CHANGED Account: $aAccount" ); > session_write_close(); > ?> > > > > Cheers, > _ > Ricardo J. A. Júnior, Software Engineer Trainee > Bowne Global Solutions > > Phone +55 21 2515 7713 > [EMAIL PROTECTED] > www.bowneglobal.com.br > > -Original Message- > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 02, 2002 2:20 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Session troubles > > On 01-02 07:45, Jaime Bozza wrote: > > I agree. Perhaps make a feature request that disallows session > starting > > if save_handler=user and you haven't defined a session handler? > Then > > it could spit out a more correct error message. > > Blast. I am still unable to get my own session handler to > work. My session handler's write never gets called; only my > session_open and session_read get calledthe default file > session handler still works, if I change save_handler back to > file instead of user. > > As for the feature request, I guess I could - is there a > mechanism to do this outlined somewhere? > > > > -Original Message- > > From: Sean LeBlanc [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, January 01, 2002 8:32 PM > >
Re: [PHP] Session troubles
On 01-02 16:06, Jaime Bozza wrote: > Returning false is invalid for the session read function, and has caused > *MANY* issues with PHP and Sessions. (Check the archives as well as the > bugs database. I have a couple in there myself) > > Change: > return false; > > To: > return ''; > > And things should start working as expected. As near as I can tell, things *are* working, but I'll change it to return the ''. What an odd thing to require - I guess it's because it is expecting a string in the "true" case. I've noticed that for the most part, PHP allows you to do things very easily, is very extensible, and yet, for something so (relatively) new, it has a lot of well, ugly, "features" like this. I don't mean to knock the whole project, as it's very cool, and I'm sure very hard work to maintain - but DB access is pretty weird, and the calls vary across DBs - I ended up coding a bit of my own thin layer to generically call DB functions, and not have to worry about mysql_foo, pgsql_foo, etc. It seems that it would be pretty easy to have that as part of the language. It's rough edges and strange issues like that that just make me scratch my head. Every single language I've worked with has them (what I call "isms" - Java-isms, PowerBuilder-isms, C-isms - I can usually become productive with the core of a language pretty quickly - usually inside of a week, as any good programmer can, but the "isms" can be the part that take a few months to get right - try telling any HR person/hiring manager that, and you won't get far, though. :) They still want X years of Y, W years of Z, rather than doing some simple aptitude type of testing, or going on recommendations, nah, let's just scan resume for keywords and time periods...no wonder they claimed they couldn't find people before the recession.), but PHP just seems to have some really weird ones that you think would be easily remedied. That being said, doing session type stuff in PHP is still a ton easier and more intuitive, IMHO, than mod_perl or some Java app servers. Also, since it's a built-in, it's rare that from project to project it will vary. Even when there are "best practices" for things like this in a language/environment, I still seem to inherit code where people go skipping down the bunny trail doing some weird and buggy stuff because they didn't know what they were doing - when it's built in, that's less likely to happen. The db layer I mentioned above would prevent just this sort of thing - maybe this is already a planned feature? -- Sean LeBlanc:[EMAIL PROTECTED] Yahoo:seanleblancathome ICQ:138565743 MSN:seanleblancathome AIM:sleblancathome Errors using inadequate data are much less than those using no data at all. -Charles Babbage (contributed by Chris Johnston) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] session troubles
your session_start() has to be the first thing in the page. no blank lines etc. like right at the top of your page. a blank line will send header info ... Steve > -Original Message- > From: Brad Wright [mailto:[EMAIL PROTECTED]] > Sent: 05 July 2001 16:21 > To: [EMAIL PROTECTED] > Subject: [PHP] session troubles > > > Hi all, > Im new to this mailing list so im not sure what to expect > from 'y'all' but > i'm hoping this will be the beginning of a long and beautiful > friendship. > > My question: > > i have a series of PHP4 pages that if I start a session > (session_start()) on > the first page (adminLogin.php), all is fine and dandy...all the > session_resources get passed to the next page (login2.php) > and i can get > acccess to those session resources. Te problem is, at the top > of the page a > warning message is displayed: > > Warning: Cannot send session cache limiter - headers already > sent (output > started at /home/e-smith/files/ibays/test/html/login2.php:1) in > /home/e-smith/files/ibays/test/html/login2.php on line 1 > > > What does this mean?? If i comment out the "session_start()" > line, i dodnt > get this message BUT i also dont get the session variuables i need. > > Hope Im making some sense, Hope someone can help. > > Thanks, > Brad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] session troubles
You must have some white space going out somewhere before your code/HTML "starts", that you are unaware of. If you can't find it, you can always buffer up your output with ob_start() and put it out later... --- Brad Wright wrote: > > Hi all, > Im new to this mailing list so im not sure what to expect from 'y'all' but > i'm hoping this will be the beginning of a long and beautiful friendship. > > My question: > > i have a series of PHP4 pages that if I start a session (session_start()) on > the first page (adminLogin.php), all is fine and dandy...all the > session_resources get passed to the next page (login2.php) and i can get > acccess to those session resources. Te problem is, at the top of the page a > warning message is displayed: > > Warning: Cannot send session cache limiter - headers already sent (output > started at /home/e-smith/files/ibays/test/html/login2.php:1) in > /home/e-smith/files/ibays/test/html/login2.php on line 1 > > What does this mean?? If i comment out the "session_start()" line, i dodnt > get this message BUT i also dont get the session variuables i need. > > Hope Im making some sense, Hope someone can help. > > Thanks, > Brad > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]