[PHP] $_SESSION variables
Instead of doing: $_SESSION['order'][$reference]['quantity'] = 0; Is there a way to get remove that part of the array altogether? Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variables
On Sat, 2009-10-24 at 07:52 -0400, Ron Piggott wrote: Instead of doing: $_SESSION['order'][$reference]['quantity'] = 0; Is there a way to get remove that part of the array altogether? Ron I don't understand your question.. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] $_SESSION variables
I am programming a shopping cart. So far I have used $_SESSION['order'][$reference]['quantity'] = 0; if the customer changed their mind about buying an item. Is there a way to remove the session variable altogether? Ron -Original Message- From: Ashley Sheridan a...@ashleysheridan.co.uk Reply-to: a...@ashleysheridan.co.uk To: ron@actsministries.org Cc: PHP General php-general@lists.php.net Subject: Re: [PHP] $_SESSION variables Date: Sat, 24 Oct 2009 12:52:17 +0100 On Sat, 2009-10-24 at 07:52 -0400, Ron Piggott wrote: Instead of doing: $_SESSION['order'][$reference]['quantity'] = 0; Is there a way to get remove that part of the array altogether? Ron I don't understand your question.. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] $_SESSION variables
Unset($_SESSION['order'][$reference]['quantity']); will clear the entire session object Bastien Sent from my iPod On Oct 24, 2009, at 8:01 AM, Ron Piggott ron@actsministries.org wrote: I am programming a shopping cart. So far I have used $_SESSION['order'][$reference]['quantity'] = 0; if the customer changed their mind about buying an item. Is there a way to remove the session variable altogether? Ron -Original Message- From: Ashley Sheridan a...@ashleysheridan.co.uk Reply-to: a...@ashleysheridan.co.uk To: ron@actsministries.org Cc: PHP General php-general@lists.php.net Subject: Re: [PHP] $_SESSION variables Date: Sat, 24 Oct 2009 12:52:17 +0100 On Sat, 2009-10-24 at 07:52 -0400, Ron Piggott wrote: Instead of doing: $_SESSION['order'][$reference]['quantity'] = 0; Is there a way to get remove that part of the array altogether? Ron I don't understand your question.. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variables
Ron Piggott wrote: Instead of doing: $_SESSION['order'][$reference]['quantity'] = 0; Is there a way to get remove that part of the array altogether? unset? unset($_SESSION['order'][$reference]['quantity']); Can't seem to reach php.net to confirm, but I use it myself ;) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_session/$_cookie trouble
I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_session/$_cookie trouble
On 28 April 2009 15:48, Gary advised: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Whatever it is on line 2 of assessresult.inc.php that is causing output to be started! More seriously, there is something on line 2 of that file that is causing something to be sent to the browser, which in turn causes the http headers to be sent. Once those headers have been sent, nothing else that wants to send headers, which includes starting the session and setting cookies, can be done. Either eliminate whatever it is on line 2 that is sending output, or move the session_start() and/or setcookie() calls above it. (This early in the file, prime candidate is actually a stray blank line outside your ?php tag, but that's only a guess based on past experience of many people in this list...!!) Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/ Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 3:59 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Igor Thanks for the link. It was suggested that I must put the session_start() before all code on the parent page. I am no longer getting the error messages,so I am assuming I am making progress, however I have yet to be able to get the $_SESSION or $_COOKIE to produce results...such as the ability to echo them. Thanks for your help. Gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281208g35fcc98t696b51a4bfc74...@mail.gmail.com... http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/ Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 3:59 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk There it is then. The HTML file causes the headers to be sent. Any output to the browser at all causes the headers to be sent, so any HTML or even spaces and newlines will trigger this error. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com... Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk There it is then. The HTML file causes the headers to be sent. Any output to the browser at all causes the headers to be sent, so any HTML or even spaces and
Re: [PHP] $_session/$_cookie trouble
On Tue, 2009-04-28 at 16:38 -0400, Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com... Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you
Re: [PHP] $_session/$_cookie trouble
Take the values out of single quotes, else it sets them as strings, and not as the variable value. Also, are you meaning to set the cookie's expiration to time()-3600? Try time()+3600. On Tue, Apr 28, 2009 at 4:49 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2009-04-28 at 16:38 -0400, Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com... Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before
Re: [PHP] $_session/$_cookie trouble
Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk There it is then. The HTML file causes the headers to be sent. Any output to the browser at all causes the headers to be sent, so any HTML or even spaces and newlines will trigger this error. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Looks to me like you are trying to set and retrieve a cookie on the same page. It doesn't work that way. Set it, access it on the next page... or, set it, and then redirect to the same page.. being sure to send a flag to hide the setcookie function to avoid the dreaded infinite loop. Also, Setting a cookie's expire param to history will delete it... so I don't think that is what you want to do. Donovan -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o D. BROOKE EUCA Design Center WebDNA Software Corp. WEB: http://www.euca.us | http://www.webdna.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o WebDNA: [** Square Bracket Utopia **] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Maybe I'm missing something, but why are you using session vars and cookie vars like you are? If you start a session it creates a cookie to track the session and the session persists your session vars. Why not just use session vars? -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION lost
On Fri, May 16, 2008 at 12:36 AM, hce [EMAIL PROTECTED] wrote: Hi, I've just installed PHP 5.2.4 on a FC 7 with a web server. $ php -v PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies That's the CLI version, which is likely completely different from your web version. They're generally two separate binaries. It seems some PHP module might be missing, I tested it with a page1.php: Sessions are handled in the core, not in a module. session_start(); $_SESSION['favcolor'] = 'green'; Then I click a link in page1.php to go another page2.php: session_start(); echo favcolr = . $_SESSION['favcolor']; It only displayed favcolr =, it was empty in $_SESSION['favcolor']. The test script page1.php and page2.php are working fine on other machines. Send the actual code and we can take a look at it. It's probably something as simple as a typo. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION lost
Hi, I've just installed PHP 5.2.4 on a FC 7 with a web server. $ php -v PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies It seems some PHP module might be missing, I tested it with a page1.php: session_start(); $_SESSION['favcolor'] = 'green'; Then I click a link in page1.php to go another page2.php: session_start(); echo favcolr = . $_SESSION['favcolor']; It only displayed favcolr =, it was empty in $_SESSION['favcolor']. The test script page1.php and page2.php are working fine on other machines. I checked with php modules, the session is there. What could I be missing in PHP modules or setup? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION lost
$ php -v PHP 5.2.4 (cli) (built: Sep 18 2007 08:50:58) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies This shows the php command line version, not the webserver php version. To do that, look at a phpinfo() page. They may indeed be the same but don't think that they always will be. I can run php4 for my webserver version and php5 command line and vice-versa. It seems some PHP module might be missing, I tested it with a page1.php: More likely the session.save_path is either not writable or not accessible by this script. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION NOT WORKING
Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. // 1.php ?php session_register('tree'); $_SESSION['tree'] = This is tree number one; header(Location: 2.php); ? // 2.php ?php print_r($_SESSION, false); ? // php.ini (incomplete) session.save_handler = files session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for Windows session.use_cookies = 1 session.name = cito session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 100 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 0 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 4 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset= The web server is Apache 2.2 with php 5.24 for both, Linux Windows. In Linux the Apache server is run by the 'apache' user, which has reading, writing and execution grants on /tmp/php/sessions/ The output for 2.php is: Array ( [tree] = This is tree number one ) is what I get on Windows, but on Linux I get: Notice: Undefined variable: _SESSION in /var/www/html/2.php on line 2 I don't know what the error is, but something evident is that on Linux session.auto_start = 1 is NOT working properly. On Windows it is not necessary to explicitly start the session to use the $_SESSION, so no need to session_start(). If on Linux I add session_start() at the top of each script, the script executes well. I want to know why session.auto_start does not work on Linux. If you require the whole php.ini, I'll send it gladly smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] $_SESSION NOT WORKING
Try adding session_start() at top of the script Balpo wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. // 1.php ?php session_register('tree'); $_SESSION['tree'] = This is tree number one; header(Location: 2.php); ? // 2.php ?php print_r($_SESSION, false); ? // php.ini (incomplete) session.save_handler = files session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for Windows session.use_cookies = 1 session.name = cito session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 100 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 0 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 4 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset= The web server is Apache 2.2 with php 5.24 for both, Linux Windows. In Linux the Apache server is run by the 'apache' user, which has reading, writing and execution grants on /tmp/php/sessions/ The output for 2.php is: Array ( [tree] = This is tree number one ) is what I get on Windows, but on Linux I get: Notice: Undefined variable: _SESSION in /var/www/html/2.php on line 2 I don't know what the error is, but something evident is that on Linux session.auto_start = 1 is NOT working properly. On Windows it is not necessary to explicitly start the session to use the $_SESSION, so no need to session_start(). If on Linux I add session_start() at the top of each script, the script executes well. I want to know why session.auto_start does not work on Linux. If you require the whole php.ini, I'll send it gladly -- Open Source ALL content management with streaming video http://wiki.sharedlog.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION NOT WORKING
On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. [snip!] Modify 2.php as follows: ?php session_start(); print_r($_SESSION); ? You only missed instantiating the session. The rest looks good. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] $_SESSION NOT WORKING
Actually his question was about why session.auto_start is not working on Linux, I almost answered what you both did :) Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: Daniel Brown [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 13 de maio de 2008 16:43 Para: Balpo Cc: PHP General Assunto: Re: [PHP] $_SESSION NOT WORKING On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. [snip!] Modify 2.php as follows: ?php session_start(); print_r($_SESSION); ? You only missed instantiating the session. The rest looks good. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION NOT WORKING
Yes, that way it works. Thanx. But the Windows version of the same code and the same php.ini ***does not *** need the session_start() because it has the session.auto_start = 1 inside php.ini. The thing is, I think session.auto_start = 1 does not work on Linux. Is this a bug? Daniel Brown wrote: On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. [snip!] Modify 2.php as follows: ?php session_start(); print_r($_SESSION); ? You only missed instantiating the session. The rest looks good. smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] $_SESSION NOT WORKING
Balpo schrieb: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. // 1.php ?php session_register('tree'); $_SESSION['tree'] = This is tree number one; header(Location: 2.php); ? // 2.php ?php print_r($_SESSION, false); ? session.auto_start = 1 I want to know why session.auto_start does not work on Linux. If you require the whole php.ini, I'll send it gladly Hi! Did you test with phpinfo() if the correct php.ini is used? regards, Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION v. Cookies
I can't see PHP sessions slowing down your site by that amount. As someone said, it should be no more than a split second. If you are having that much of a problem with them, then I would say it is either your implementation, or another determining factor. I would not, personally, stray away from PHP's GC of sessions. I would imagine that any third-party concoction could not be any faster. I would however, check to see how long PHP takes to clean up defunct sessions, and also monitor how many sessions are lying around at any given time. Regards, - Craige -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION v. Cookies
On Wed, May 7, 2008 at 2:35 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2008-05-07 at 14:29 -0600, Nathan Nobbe wrote: On Wed, May 7, 2008 at 2:22 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2008-05-07 at 16:03 -0400, tedd wrote: At 12:34 PM -0400 5/7/08, Robert Cummings wrote: The exception being when it performs cleanup. Cleanup should be relegated to a cron job. Rob: What clean-up? All the inactive session files... inactive and garbage collection time is denoted by the following php.ini settings: session.gc_probability= 1 ; percentual probability that the ; 'garbage collection' process is ; started ; on every session initialization session.gc_maxlifetime= 1440 ; after this number of seconds, ; stored data will be seen as ; 'garbage' and cleaned up by the ; gc process so where is the setting, using the stock session handler, to relegate the gc process to a cron job ? session.gc_probability = 0 but wont it still try to run sometimes since that setting determines whether or not the gc will run *every* time ? i would imagine if it was for *any* time, setting session.gc_probability = 0 would effectively disable the stock gc. that setting is the chance (in percents) for the stock gc to run at any request. so if it is set to 0, it does not have a chance ;) of course it will try but it always decides not to run greets, Zoltán Németh Then do it yourself in a script called by cron. it would be nice if you could latch into the one they provide out of the box and just invoke it via cron.. -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION v. Cookies
Dear PHP List, PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing deving with FireFox and Konqueror (Linux). I am building a site with multiple tools and want to pass variables throughout them all. Before, I was passing variables using hidden HTML Form tags, but the site has grown too large for this tactic, so I went to using $_SESSION. However, when I started using $_SESSION, my site loads 3-5 times slower then before. A page that queried MySQL and built itself in 3-5 seconds was now taking 15-20. While more has changed then just $_SESSION, it is really the only significant difference. Is $_SESSION slowing down my site? Is there a faster alternative to global variables then using $_SESSION? Are using regular cookies faster? Any help is appreciated. Thanks, Scott -- Scott Campbell If you do what you've always done, you'll get what you've always gotten. Courage is resistance to fear .. not absence of fear.
Re: [PHP] $_SESSION v. Cookies
On Wed, 2008-05-07 at 12:27 -0400, Scott Campbell wrote: Dear PHP List, PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing deving with FireFox and Konqueror (Linux). I am building a site with multiple tools and want to pass variables throughout them all. Before, I was passing variables using hidden HTML Form tags, but the site has grown too large for this tactic, so I went to using $_SESSION. However, when I started using $_SESSION, my site loads 3-5 times slower then before. A page that queried MySQL and built itself in 3-5 seconds was now taking 15-20. While more has changed then just $_SESSION, it is really the only significant difference. Is $_SESSION slowing down my site? Is there a faster alternative to global variables then using $_SESSION? Are using regular cookies faster? Any help is appreciated. How are your sessions implemented? Are you using the stock PHP session functionality or did you cook your own solution? I can't see the stock PHP solution adding anything more than a split second to your page time. The exception being when it performs cleanup. Cleanup should be relegated to a cron job. Have you added anything new to the database? new query perhaps on a large table that doesn't make use of indexes? Small changes can have a bigger impact than large changes depending on what exactly changed. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION v. Cookies
Scott Campbell [EMAIL PROTECTED] wrote: Dear PHP List, PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing deving with FireFox and Konqueror (Linux). I am building a site with multiple tools and want to pass variables throughout them all. Before, I was passing variables using hidden HTML Form tags, but the site has grown too large for this tactic, so I went to using $_SESSION. However, when I started using $_SESSION, my site loads 3-5 times slower then before. A page that queried MySQL and built itself in 3-5 seconds was now taking 15-20. While more has changed then just $_SESSION, it is really the only significant difference. Is $_SESSION slowing down my site? Is there a faster alternative to global variables then using $_SESSION? Are using regular cookies faster? Any help is appreciated. Thanks, Scott Did you add any includes and are they include or include_once or require VS. require_once? I found stress tests that show that an include is faster then an include_once and so removing the _once from includes and requires will speed up your site. HTH, Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION v. Cookies
At 12:34 PM -0400 5/7/08, Robert Cummings wrote: The exception being when it performs cleanup. Cleanup should be relegated to a cron job. Rob: What clean-up? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION v. Cookies
On Wed, 2008-05-07 at 16:03 -0400, tedd wrote: At 12:34 PM -0400 5/7/08, Robert Cummings wrote: The exception being when it performs cleanup. Cleanup should be relegated to a cron job. Rob: What clean-up? All the inactive session files... inactive and garbage collection time is denoted by the following php.ini settings: session.gc_probability= 1 ; percentual probability that the ; 'garbage collection' process is ; started ; on every session initialization session.gc_maxlifetime= 1440 ; after this number of seconds, ; stored data will be seen as ; 'garbage' and cleaned up by the ; gc process Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION v. Cookies
On Wed, May 7, 2008 at 2:22 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2008-05-07 at 16:03 -0400, tedd wrote: At 12:34 PM -0400 5/7/08, Robert Cummings wrote: The exception being when it performs cleanup. Cleanup should be relegated to a cron job. Rob: What clean-up? All the inactive session files... inactive and garbage collection time is denoted by the following php.ini settings: session.gc_probability= 1 ; percentual probability that the ; 'garbage collection' process is ; started ; on every session initialization session.gc_maxlifetime= 1440 ; after this number of seconds, ; stored data will be seen as ; 'garbage' and cleaned up by the ; gc process so where is the setting, using the stock session handler, to relegate the gc process to a cron job ? -nathan
Re: [PHP] $_SESSION v. Cookies
At 4:22 PM -0400 5/7/08, Robert Cummings wrote: On Wed, 2008-05-07 at 16:03 -0400, tedd wrote: At 12:34 PM -0400 5/7/08, Robert Cummings wrote: The exception being when it performs cleanup. Cleanup should be relegated to a cron job. Rob: What clean-up? All the inactive session files... inactive and garbage collection time is denoted by the following php.ini settings: session.gc_probability= 1 ; percentual probability that the ; 'garbage collection' process is ; started ; on every session initialization session.gc_maxlifetime= 1440 ; after this number of seconds, ; stored data will be seen as ; 'garbage' and cleaned up by the ; gc process Cheers, Rob. Oh, Okay. That's an automatic practice taken from the php.ini settings. I was thinking that maybe one was supposed to do something after using sessions. Thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION v. Cookies
On Wed, 2008-05-07 at 14:29 -0600, Nathan Nobbe wrote: On Wed, May 7, 2008 at 2:22 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2008-05-07 at 16:03 -0400, tedd wrote: At 12:34 PM -0400 5/7/08, Robert Cummings wrote: The exception being when it performs cleanup. Cleanup should be relegated to a cron job. Rob: What clean-up? All the inactive session files... inactive and garbage collection time is denoted by the following php.ini settings: session.gc_probability= 1 ; percentual probability that the ; 'garbage collection' process is ; started ; on every session initialization session.gc_maxlifetime= 1440 ; after this number of seconds, ; stored data will be seen as ; 'garbage' and cleaned up by the ; gc process so where is the setting, using the stock session handler, to relegate the gc process to a cron job ? session.gc_probability = 0 Then do it yourself in a script called by cron. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION v. Cookies
On Wed, May 7, 2008 at 2:35 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2008-05-07 at 14:29 -0600, Nathan Nobbe wrote: On Wed, May 7, 2008 at 2:22 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2008-05-07 at 16:03 -0400, tedd wrote: At 12:34 PM -0400 5/7/08, Robert Cummings wrote: The exception being when it performs cleanup. Cleanup should be relegated to a cron job. Rob: What clean-up? All the inactive session files... inactive and garbage collection time is denoted by the following php.ini settings: session.gc_probability= 1 ; percentual probability that the ; 'garbage collection' process is ; started ; on every session initialization session.gc_maxlifetime= 1440 ; after this number of seconds, ; stored data will be seen as ; 'garbage' and cleaned up by the ; gc process so where is the setting, using the stock session handler, to relegate the gc process to a cron job ? session.gc_probability = 0 but wont it still try to run sometimes since that setting determines whether or not the gc will run *every* time ? i would imagine if it was for *any* time, setting session.gc_probability = 0 would effectively disable the stock gc. Then do it yourself in a script called by cron. it would be nice if you could latch into the one they provide out of the box and just invoke it via cron.. -nathan
Re: [PHP] $_SESSION problem [NOW SOLVED]
On Fri, Apr 11, 2008 at 5:34 PM, tedd [EMAIL PROTECTED] wrote: At 11:33 AM -0400 4/11/08, Daniel Brown wrote: On Fri, Apr 11, 2008 at 10:29 AM, Ford, Mike [EMAIL PROTECTED] wrote: Sounds like a register_globals=On issue It does to me, as well. I know, Tedd, that on the php1.net site that you mentioned to me off-list, I'm about 99% positive that it's the reason. Shared hosts generally keep register_globals on and leave it up to the individual customer to turn it off. On that particular server, though, since it's mostly developers, I may just send out an email to get feedback and turn it off at the main, and then allow ya'all to override it on your individual sites. The thing that makes me wonder (and I haven't checked myself to verify) is why two sites, on the same server, having the same Hey! I found it and you were right. On my webbytedd.com site, I had a htaccess file that read: AddDefaultCharset utf-8 php_value register_globals 0 php_value magic_quotes_gpc 0 php_value magic_quotes_sybase 0 php_value magic_quotes_runtime 0 And I didn't have that htaccess file on my sperling.com site. However, what fooled me was in both scripts I had: ini_set( 'register_globals', '0' ); So, I thought that was the same, but apparently it's not. Maybe because my server had safe_mode ON it won't allow it -- I don't know. Another question for another time. Thanks a bunch guys! Cheers, tedd PS: I did try the session_write_close and several other suggestions, but none worked. The register_globals value is something that cannot be set at runtime. If you pass it to ini_set(), it will appear to work -- you won't get an error and successive calls to phpinfo() will show the new value; however, by the time PHP gets far enough down the chain to execute your ini_set() command, PHP has already determined whether it should register global variables. The manual indicates that this wasn't always the case, but (not knowing the internals then or now) I don't understand how. (The table on that page says it was PHP_INI_ALL for versions up to 4.2.3.) http://us.php.net/manual/en/ini.core.php#ini.register-globals Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION problem
At 5:10 PM -0600 4/10/08, Nathan Nobbe wrote: On Thu, Apr 10, 2008 at 5:05 PM, Nathan Nobbe mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: On Thu, Apr 10, 2008 at 4:29 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: you might just dump out the session component of the php config on each site to ensure theyre the same. on that last note, this could be useful, ?php die(var_dump(ini_get_all('session'))); ? -nathan They are identical -- and the same as shown in phpInfo, as I said. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com
Re: [PHP] $_SESSION problem
At 5:05 PM -0600 4/10/08, Nathan Nobbe wrote: On Thu, Apr 10, 2008 at 4:29 PM, tedd mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: Hi gang: I'm stumped and in need of some expert explanation. I have prepared two demos (showing code) for your enjoyment: [1] http://www.webbytedd.com/x/index.phphttp://www.webbytedd.com/x/index.php [2] http://sperling.com/x/index.phphttp://sperling.com/x/index.php Both of these demos have the exact same code; and are on the same server; with exactly the same php-info -- so, why do they behave differently re sessions? Note that [1] will retain the session values throughout the entire session, while [2] does not and loses session values. as a sanity check have you dumped out the contents of the session after writing to it on [2] ? eg. ?php // $_SESSION['q6'] = ( isset($_SESSION['q6']) ? $_SESSION['q6'] : 0); $_SESSION['q7'] = ( isset($_SESSION['q7']) ? $_SESSION['q7'] : 0); $_SESSION['q8'] = ( isset($_SESSION['q8']) ? $_SESSION['q8'] : 0); $_SESSION['q9'] = ( isset($_SESSION['q9']) ? $_SESSION['q9'] : 0); var_dump($_SESSION); ? you might just dump out the session component of the php config on each site to ensure theyre the same. -nathan Isn't that what the code is doing? I'm dumping the results in a print_r($_SESSION) -- isn't that he same thing? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com
Re: [PHP] $_SESSION problem [SOLVED (sort-of)]
At 10:12 PM -0400 4/10/08, Eric Wood wrote: tedd wrote: [1] http://www.webbytedd.com/x/index.php [2] http://sperling.com/x/index.php Both of these demos have the exact same code; and are on the same server; with exactly the same php-info -- so, why do they behave differently re sessions? Strange. I've run into issues whenever I use variable names which are the same as session variables. It's as if they step on each others toes. I try to use uniq var names. I've also recently run into customized 401 pages (which you may not see happen, check the logs) start up and the session data gets overwrite due to a lack of session file locking. -eric -eric: You didn't provide the reason why, but you did provide a solution. Changing the variable names to be different than the session names fixed the problem. Now, if any php guru would care to tell me why, I would really like to know. Thanks eric. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION problem [SOLVED (sort-of)]
On 11 April 2008 14:45, tedd advised: At 10:12 PM -0400 4/10/08, Eric Wood wrote: tedd wrote: [1] http://www.webbytedd.com/x/index.php [2] http://sperling.com/x/index.php Both of these demos have the exact same code; and are on the same server; with exactly the same php-info -- so, why do they behave differently re sessions? Strange. I've run into issues whenever I use variable names which are the same as session variables. It's as if they step on each others toes. I try to use uniq var names. I've also recently run into customized 401 pages (which you may not see happen, check the logs) start up and the session data gets overwrite due to a lack of session file locking. -eric -eric: You didn't provide the reason why, but you did provide a solution. Changing the variable names to be different than the session names fixed the problem. Now, if any php guru would care to tell me why, I would really like to know. Sounds like a register_globals=On issue -- Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 812 4730 Fax: +44 113 812 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION problem [SOLVED (sort-of)]
On Fri, Apr 11, 2008 at 10:29 AM, Ford, Mike [EMAIL PROTECTED] wrote: Sounds like a register_globals=On issue It does to me, as well. I know, Tedd, that on the php1.net site that you mentioned to me off-list, I'm about 99% positive that it's the reason. Shared hosts generally keep register_globals on and leave it up to the individual customer to turn it off. On that particular server, though, since it's mostly developers, I may just send out an email to get feedback and turn it off at the main, and then allow ya'all to override it on your individual sites. The thing that makes me wonder (and I haven't checked myself to verify) is why two sites, on the same server, having the same phpinfo() output, would have different results. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION problem
On Fri, Apr 11, 2008 at 6:30 AM, tedd [EMAIL PROTECTED] wrote: Isn't that what the code is doing? I'm dumping the results in a print_r($_SESSION) -- isn't that he same thing? sorry tedd; obviously i was hasty to post. but i figured just looking for the obvious would be a good exercise as i cant count the times ive launched into an exhaustive search for the problem when its really something silly ive overlooked. that said; i know ur smart and you always post hard problems for 'the gang' ;) anyway, taking the cue from some of the other responses, have you looked at the page on session_write_close() ? http://us2.php.net/manual/en/function.session-write-close.php its kind of interesting; it looks like lots of people have run into issues using the location header to redirect clients to another script after a form submission. its never happened to me (knock on wood) but anyway some of the posts on that page may be worth reading. also, though it wont answer your question about why its happening, i was thinking you might alter the flow of ur scripts to see if you can get the same behavior on both sites. heres what i was thinking: add a hidden input to the form (from index.php) input type=hidden name=formsubmission value=1 / then after you call session_start() in index.php, have the following if(isset($_POST['formsubmission']) $_POST['formsubmission'] == '1')) { include('part2.php'); // process form submission } then, make the following adjustments to part2.php remove the call to session_start() remove the call to header(location ... remove the call to exit() i think this will have the effect that the work flow is unaltered, but the organization of the logic on the back end will be different. effectively the call to header(location... will be removed so we would be able to tell if the issue is related to that. -nathan
Re: [PHP] $_SESSION problem [SOLVED (sort-of)]
top posting for the hell of it; disregard last post; i didnt see the [solved] sort-of thread. -nathan On Fri, Apr 11, 2008 at 7:44 AM, tedd [EMAIL PROTECTED] wrote: At 10:12 PM -0400 4/10/08, Eric Wood wrote: tedd wrote: [1] http://www.webbytedd.com/x/index.php [2] http://sperling.com/x/index.php Both of these demos have the exact same code; and are on the same server; with exactly the same php-info -- so, why do they behave differently re sessions? Strange. I've run into issues whenever I use variable names which are the same as session variables. It's as if they step on each others toes. I try to use uniq var names. I've also recently run into customized 401 pages (which you may not see happen, check the logs) start up and the session data gets overwrite due to a lack of session file locking. -eric -eric: You didn't provide the reason why, but you did provide a solution. Changing the variable names to be different than the session names fixed the problem. Now, if any php guru would care to tell me why, I would really like to know. Thanks eric. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION problem [NOW SOLVED]
At 11:33 AM -0400 4/11/08, Daniel Brown wrote: On Fri, Apr 11, 2008 at 10:29 AM, Ford, Mike [EMAIL PROTECTED] wrote: Sounds like a register_globals=On issue It does to me, as well. I know, Tedd, that on the php1.net site that you mentioned to me off-list, I'm about 99% positive that it's the reason. Shared hosts generally keep register_globals on and leave it up to the individual customer to turn it off. On that particular server, though, since it's mostly developers, I may just send out an email to get feedback and turn it off at the main, and then allow ya'all to override it on your individual sites. The thing that makes me wonder (and I haven't checked myself to verify) is why two sites, on the same server, having the same Hey! I found it and you were right. On my webbytedd.com site, I had a htaccess file that read: AddDefaultCharset utf-8 php_value register_globals 0 php_value magic_quotes_gpc 0 php_value magic_quotes_sybase 0 php_value magic_quotes_runtime 0 And I didn't have that htaccess file on my sperling.com site. However, what fooled me was in both scripts I had: ini_set( 'register_globals', '0' ); So, I thought that was the same, but apparently it's not. Maybe because my server had safe_mode ON it won't allow it -- I don't know. Another question for another time. Thanks a bunch guys! Cheers, tedd PS: I did try the session_write_close and several other suggestions, but none worked. -- --- http://sperling.com http://ancientstones.com http://earthstones.com
[PHP] $_SESSION problem
Hi gang: I'm stumped and in need of some expert explanation. I have prepared two demos (showing code) for your enjoyment: [1] http://www.webbytedd.com/x/index.php [2] http://sperling.com/x/index.php Both of these demos have the exact same code; and are on the same server; with exactly the same php-info -- so, why do they behave differently re sessions? Note that [1] will retain the session values throughout the entire session, while [2] does not and loses session values. Why? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION problem
On Thu, Apr 10, 2008 at 4:29 PM, tedd [EMAIL PROTECTED] wrote: Hi gang: I'm stumped and in need of some expert explanation. I have prepared two demos (showing code) for your enjoyment: [1] http://www.webbytedd.com/x/index.php [2] http://sperling.com/x/index.php Both of these demos have the exact same code; and are on the same server; with exactly the same php-info -- so, why do they behave differently re sessions? Note that [1] will retain the session values throughout the entire session, while [2] does not and loses session values. as a sanity check have you dumped out the contents of the session after writing to it on [2] ? eg. ?php // $_SESSION['q6'] = ( isset($_SESSION['q6']) ? $_SESSION['q6'] : 0); $_SESSION['q7'] = ( isset($_SESSION['q7']) ? $_SESSION['q7'] : 0); $_SESSION['q8'] = ( isset($_SESSION['q8']) ? $_SESSION['q8'] : 0); $_SESSION['q9'] = ( isset($_SESSION['q9']) ? $_SESSION['q9'] : 0); var_dump($_SESSION); ? also, doubtful or id assume youd mention it; but do you have .htaccess on either of the sites? you might just dump out the session component of the php config on each site to ensure theyre the same. -nathan
Re: [PHP] $_SESSION problem
On Thu, Apr 10, 2008 at 5:05 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Thu, Apr 10, 2008 at 4:29 PM, tedd [EMAIL PROTECTED] wrote: you might just dump out the session component of the php config on each site to ensure theyre the same. on that last note, this could be useful, ?php die(var_dump(ini_get_all('session'))); ? -nathan
Re: [PHP] $_SESSION problem
tedd wrote: [1] http://www.webbytedd.com/x/index.php [2] http://sperling.com/x/index.php Both of these demos have the exact same code; and are on the same server; with exactly the same php-info -- so, why do they behave differently re sessions? Strange. I've run into issues whenever I use variable names which are the same as session variables. It's as if they step on each others toes. I try to use uniq var names. I've also recently run into customized 401 pages (which you may not see happen, check the logs) start up and the session data gets overwrite due to a lack of session file locking. -eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION problem
it looks fine to me. but i want to share one bad experience with sessions. the code i wrote work just fine on my testing server (please note, the phpinfo is same with my production server). after days of figuring out why the session do not work. finally, i found the solutions. the solutions is to add a @session_write_close() on the end of the execution code. on my case it happen every time i forward the page. so adding the @session_write_close before the header('location: ') fix the problem. this might be a possible explanation..
Re: [PHP] $_SESSION problem
I believe you can accomplish the same thing by just putting this in: register_shutdown_function('session_write_close'); On 4/10/08, paragasu [EMAIL PROTECTED] wrote: it looks fine to me. but i want to share one bad experience with sessions. the code i wrote work just fine on my testing server (please note, the phpinfo is same with my production server). after days of figuring out why the session do not work. finally, i found the solutions. the solutions is to add a @session_write_close() on the end of the execution code. on my case it happen every time i forward the page. so adding the @session_write_close before the header('location: ') fix the problem. this might be a possible explanation.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
Roman: [...] You don't need to know your IP. See the grammar for AbsoluteURI: ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt I'm asking this because my IP is dynamic and I'm using a free redirection service. My site is at 'http://something.no-ip.org/sitename' can I use 'http://something.no-ip.org/sitename/index.php?vaz=value' on the Locarion header? Actually you *must* use it instead of just the index... part. Thank you Roman, I'm now working with absolute paths! :) I Never thought that HTML had those specs... With the relative link it worked and so it was OK for me... Bye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
On Jan 18, 2007, at 12:59 AM, Nuno Vaz Oliveira wrote: Roman: [...] You don't need to know your IP. See the grammar for AbsoluteURI: ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt I'm asking this because my IP is dynamic and I'm using a free redirection service. My site is at 'http://something.no-ip.org/sitename' can I use 'http://something.no-ip.org/sitename/index.php?vaz=value' on the Locarion header? Actually you *must* use it instead of just the index... part. Thank you Roman, I'm now working with absolute paths! :) I Never thought that HTML had those specs... With the relative link it worked and so it was OK for me... Bye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
# [EMAIL PROTECTED] / 2007-01-18 08:59:11 +: Roman: [...] You don't need to know your IP. See the grammar for AbsoluteURI: ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt I'm asking this because my IP is dynamic and I'm using a free redirection service. My site is at 'http://something.no-ip.org/sitename' can I use 'http://something.no-ip.org/sitename/index.php?vaz=value' on the Locarion header? Actually you *must* use it instead of just the index... part. Thank you Roman, I'm now working with absolute paths! :) I Never thought that HTML had those specs... It's not HTML, that's a completely different animal! HTTP is a transport protocol, HTML is a document format. HTML documents are but one type of things you can transport using HTTP. With the relative link it worked and so it was OK for me... Don't rely on browser bugs and features present to work around popular bugs in server-side scripts. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
From Roman: Roman: [...] You don't need to know your IP. See the grammar for AbsoluteURI: ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt I'm asking this because my IP is dynamic and I'm using a free redirection service. My site is at 'http://something.no-ip.org/sitename' can I use 'http://something.no-ip.org/sitename/index.php?vaz=value' on the Locarion header? Actually you *must* use it instead of just the index... part. Thank you Roman, I'm now working with absolute paths! :) I Never thought that HTML had those specs... It's not HTML, that's a completely different animal! HTTP is a transport protocol, HTML is a document format. HTML documents are but one type of things you can transport using HTTP. With the relative link it worked and so it was OK for me... Don't rely on browser bugs and features present to work around popular bugs in server-side scripts. Sorry, that was my BUG!! Your totally right and I know that. I was with my head at some other place when I wrote that (probably). I don't know that much of HTTP (or other protocols) but my knowladge of (X)HTML (used by its semantic) is very good. Also, I use headers to send files, images and document types and that's got nothing to do with HTML. Glad that you reminded me, thanks, Nuno -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
Stut wrote: Redirecting using a Location header is not the only thing you can do with the header() function. It will never end processing of the script no matter what you pass to it. The example on the manual page for the header() function says as much (http://php.net/header), you read that right? ?php header(Location: http://www.example.com/;); /* Redirect browser */ /* Make sure that code below does not get executed when we redirect. */ exit; ? -Stut Well, I feel like a du***ss! No, I hadn't read that. I promisse, and this one is to keep, I won't post to this list again without dedicate enough time to the problem, at least to read the manual. Anyway, thank you for confirm what I should have known in advance and also for remembering me that PHP developers have a PHP manual for PHP users... Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
# [EMAIL PROTECTED] / 2007-01-17 19:06:16 +: Stut wrote: Redirecting using a Location header is not the only thing you can do with the header() function. It will never end processing of the script no matter what you pass to it. The example on the manual page for the header() function says as much (http://php.net/header), you read that right? Well, I feel like a du***ss! No, I hadn't read that. I promisse, and this one is to keep, I won't post to this list again without dedicate enough time to the problem, at least to read the manual. Anyway, thank you for confirm what I should have known in advance and also for remembering me that PHP developers have a PHP manual for PHP users... Also, the header() call you provided in the original post was a violation of HTTP. Knowing the programming language is just one of your responsibilities IMNSHO. The manual for HTTP users (you!) is at ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
Roman wrote: # [EMAIL PROTECTED] / 2007-01-17 19:06:16 +: Stut wrote: Redirecting using a Location header is not the only thing you can do with the header() function. It will never end processing of the script no matter what you pass to it. The example on the manual page for the header() function says as much (http://php.net/header), you read that right? Well, I feel like a du***ss! No, I hadn't read that. I promisse, and this one is to keep, I won't post to this list again without dedicate enough time to the problem, at least to read the manual. Anyway, thank you for confirm what I should have known in advance and also for remembering me that PHP developers have a PHP manual for PHP users... Also, the header() call you provided in the original post was a violation of HTTP. Knowing the programming language is just one of your responsibilities IMNSHO. The manual for HTTP users (you!) is at ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt Hi Roman, My English is not the best and I'm not sure what you mean. By looking at the document you linked I'm thinking that the problem you're talking about is not the '?var=value' but instead, the fact of being using a relative URL. Am I correct? If so, is there a way to know the full address of the index.php file? I'm asking this because my IP is dynamic and I'm using a free redirection service. My site is at 'http://something.no-ip.org/sitename' can I use 'http://something.no-ip.org/sitename/index.php?vaz=value' on the Locarion header? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
# [EMAIL PROTECTED] / 2007-01-18 00:06:27 +: Roman wrote: Also, the header() call you provided in the original post was a violation of HTTP. Knowing the programming language is just one of your responsibilities IMNSHO. The manual for HTTP users (you!) is at ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt My English is not the best and I'm not sure what you mean. By looking at the document you linked I'm thinking that the problem you're talking about is not the '?var=value' but instead, the fact of being using a relative URL. Am I correct? Yes. If so, is there a way to know the full address of the index.php file? You don't need to know your IP. See the grammar for AbsoluteURI: ftp://ftp.rfc-editor.org/in-notes/rfc2396.txt I'm asking this because my IP is dynamic and I'm using a free redirection service. My site is at 'http://something.no-ip.org/sitename' can I use 'http://something.no-ip.org/sitename/index.php?vaz=value' on the Locarion header? Actually you *must* use it instead of just the index... part. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION variable gets lost on FORM action
Hi, I'm working on a website and one of the features that I've implemented so far is the user timeout. Every time that a user browses to a different page, the variable named $_SESSION['user']['lastactive'] is updated to the current time. However, before that, my PHP scripts check if the session for this user had timed out or not... The script that checks that is named session.php and it is included in every file. If it detects a timeout, it sets a variable $_SESSION['form']['errors'] to a string ('Your session has expired... Bla, bla, bla...') and then redirects to the login.php and the user will see that he his being asked to login again for the reason displayed. Everything works great except in one situation... If the timeout period happens when the user is filling a form, the action that it executes (process.php) will also include session.php and it sets the error string but when it redirects to login.php the $_SESSION['form']['errors'] variable is empty... Can anyone help me with this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
On 1/16/07, Nuno Oliveira [EMAIL PROTECTED] wrote: Hi, I'm working on a website and one of the features that I've implemented so far is the user timeout. Every time that a user browses to a different page, the variable named $_SESSION['user']['lastactive'] is updated to the current time. However, before that, my PHP scripts check if the session for this user had timed out or not... The script that checks that is named session.php and it is included in every file. If it detects a timeout, it sets a variable $_SESSION['form']['errors'] to a string ('Your session has expired... Bla, bla, bla...') and then redirects to the login.php and the user will see that he his being asked to login again for the reason displayed. Everything works great except in one situation... If the timeout period happens when the user is filling a form, the action that it executes (process.php) will also include session.php and it sets the error string but when it redirects to login.php the $_SESSION['form']['errors'] variable is empty... You must be unsetting the individual $_SESSION['form']['errors'] variable or the entire $_SESSION array somewhere in there. David
Re: [PHP] $_SESSION variable gets lost on FORM action
David Giragosian wrote: On 1/16/07, Nuno Oliveira [EMAIL PROTECTED] wrote: Hi, I'm working on a website and one of the features that I've implemented so far is the user timeout. Every time that a user browses to a different page, the variable named $_SESSION['user']['lastactive'] is updated to the current time. However, before that, my PHP scripts check if the session for this user had timed out or not... The script that checks that is named session.php and it is included in every file. If it detects a timeout, it sets a variable $_SESSION['form']['errors'] to a string ('Your session has expired... Bla, bla, bla...') and then redirects to the login.php and the user will see that he his being asked to login again for the reason displayed. Everything works great except in one situation... If the timeout period happens when the user is filling a form, the action that it executes (process.php) will also include session.php and it sets the error string but when it redirects to login.php the $_SESSION['form']['errors'] variable is empty... You must be unsetting the individual $_SESSION['form']['errors'] variable or the entire $_SESSION array somewhere in there. David Hi Davis, thanks for the reply. I think that I've found the problem... But if you (or anyone else) can confirm I would appreciate. Sometimes in my code I use the Header('Location: index.php?var=value'); and I've found out (I think) that when one of these headers are executed by PHP, the rest of the script gets executed. I'm thinking that this is the problem because I've eliminated all the occurrences where the SESSION var was cleared until only one exists and it was after a Location Header. I've put an exit(); after the header and the problem was gone... :) Is this the correct PHP/HTML behavior or is there another problem? Am I supposed to put an exit(); after a header Location to make sure that no more code gets executed? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION variable gets lost on FORM action
Nuno Oliveira wrote: Sometimes in my code I use the Header('Location: index.php?var=value'); and I've found out (I think) that when one of these headers are executed by PHP, the rest of the script gets executed. I'm thinking that this is the problem because I've eliminated all the occurrences where the SESSION var was cleared until only one exists and it was after a Location Header. I've put an exit(); after the header and the problem was gone... :) Is this the correct PHP/HTML behavior or is there another problem? Am I supposed to put an exit(); after a header Location to make sure that no more code gets executed? Redirecting using a Location header is not the only thing you can do with the header() function. It will never end processing of the script no matter what you pass to it. The example on the manual page for the header() function says as much (http://php.net/header), you read that right? ?php header(Location: http://www.example.com/;); /* Redirect browser */ /* Make sure that code below does not get executed when we redirect. */ exit; ? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]
Daevid Vincent wrote: No no no. I'm NOT passing data between servers. It's just two pages on the same server. One that sets up the session/class and the other page just re-loads the session. When I talk about two different servers, I copy the entire source/db schema from one server to the other so they are clones for all intents and purposes. One server works the way I'd expect. The other doesn't. SAME code on both. Same schema. Nearly identical LAMP versions. keyword is 'Nearly' - please take into account that the behaviour of php can change from version to version (sometimes the change is completely unintentional and unwanted.): [EMAIL PROTECTED]:/lockdown# php --version PHP 5.0.3 (cli) (built: Jan 5 2006 13:18:18) PHP5.0.3 Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend Technologies with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend Technologies the not working box doesn't run the Zend stuff - try turning it off to see if that break your working machine (doubtful) NOT WORKING BOX: vmware apache2-php5 # php --version PHP 5.0.5-pl3-gentoo (cli) (built: Dec 14 2005 15:44:04) PHP5.0.5 (or even PHP5.0.5-pl3-gentoo what exotic flavor that might be) given that the not working box is running php5.0.5 and the working box a prior version gives me the sneaking suspicion (spelling!?) that you may be looking at a reference related problem. I assume your php CLI is from the same build as the apache module (or whatever sapi your websaerver uses), correct? (otherwise you'll need to look at the version info in phpinfo() as viewed via your webbrowser) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies This is why I'm saying, it's not my PHP code or database or anything like that. It must be some kind of server configuration, but I can't figure out what it would be. I've compared the php.ini files and don't see anything that seems relevant. the session is not set to auto start on the not working server per chance? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 4:54 PM To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help] You say it's working on one box and not on the other? Maybe I'm wrong (and sounds like I am) but I thought that you couldn't pass objects between scripts even with serialize()? Certainly sounds like it was working for you... can anyone clarify what objects/variables/data types can be passed from script to script and what can't? tg, try the manual. I know things like database connections can't be shared (that is, you can't assign a MySQL connect link to a variable then pass that variable/connect to the next script, it needs to reconnect the next time around.. or am I wrong about that too? hah) -TG God I'm tired = = = Original message = = = Thought I'd give this another shot since I still can't figure it out after nearly a week... I have a gentoo server that doesn't save/restore the CLASS portion of a session, but it does retain other $_SESSION values. This code works fine on a debian box. WORKING BOX: [snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]
Thought I'd give this another shot since I still can't figure it out after nearly a week... I have a gentoo server that doesn't save/restore the CLASS portion of a session, but it does retain other $_SESSION values. This code works fine on a debian box. WORKING BOX: [EMAIL PROTECTED]:/lockdown# php --version PHP 5.0.3 (cli) (built: Jan 5 2006 13:18:18) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend Technologies with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend Technologies NOT WORKING BOX: vmware apache2-php5 # php --version PHP 5.0.5-pl3-gentoo (cli) (built: Dec 14 2005 15:44:04) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies I've compared the php.ini files and can't find anything related to sessions that is different. In fact they're almost the same with a few minor exceptions that should have no effect that I can think of. Here is the code I'm executing: ?php [SNIP DATABASE LOAD, ETC.] echo BUserData array = /BBR\n; print_r($UserData); //set the session variables: $_SESSION['login'] = true; $_SESSION['ie'] = (stristr($_SERVER['HTTP_USER_AGENT'],MSIE)) ? true : false; $_SESSION['id'] = $UserData['id']; $_SESSION['username'] = $UserData['username']; $_SESSION['firstname'] = $UserData['firstname']; $_SESSION['lastname'] = $UserData['lastname']; $_SESSION['email'] = $UserData['email']; $_SESSION['foo']= '1234567890'; require_once('includes/classes/User.class.php'); $_SESSION['user'] = new User($UserData['id']); echo PB_SESSION array = /BBR\n; var_dump($_SESSION); echo PBUSERNAME/B = .$_SESSION['user']-get_username().BR\n; exit; ? Which properly results in this (as it's all on the same page): UserData array = Array ( [id] = 1 [firstname] = Daevid [lastname] = Vincent [email] = [EMAIL PROTECTED] ) snip _SESSION array = array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1 [username]= string(6) daevid [firstname]= string(6) Daevid [lastname]= string(7) Vincent [email]= string(17) [EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]= object(User)#2 (24) { [username:protected]= string(6) daevid [firstname:protected]= string(6) Daevid [lastname:protected]= string(7) Vincent [email:protected]= string(17) [EMAIL PROTECTED] ... snip } } USERNAME = daevid Now I load a simple session loading test page with this code: ?php require_once('includes/classes/User.class.php'); session_start(); echo BSESSION TEST:P/B; var_dump($_SESSION); exit; ? On the working box things are fine (obviously): SESSION TEST: array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1 [username]= string(6) daevid [firstname]= string(6) Daevid [lastname]= string(7) Vincent [email]= string(17) [EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]= object(User)#1 (24) { [username:protected]= string(6) daevid [firstname:protected]= string(6) Daevid [lastname:protected]= string(7) Vincent [email:protected]= string(17) [EMAIL PROTECTED] [timestamp:protected]= string(19) -00-00 00:00:00 ... snip } } but on the broken box I see: SESSION TEST: array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1 [username]= string(6) daevid [firstname]= string(6) Daevid [lastname]= string(7) Vincent [email]= string(17) [EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]= object(User)#1 (20) { [username:protected]= string(0) [firstname:protected]= string(0) [lastname:protected]= string(0) [email:protected]= string(0) [timestamp:protected]= NULL ... snip } } Notice how the regular session info is there, but the User class is all empty or NULL. So SOME of the $_SESSION is working, but not the User class portion. This is completely baffling to me. Examining the /tmp/sess_* file shows this same data. Here is the session portion of php.ini on the broken box: [Session] ; Handler used to store/retrieve data. session.save_handler = files ; Argument passed to save_handler. In the case of files, this is the path ; where data files are stored. Note: Windows users have to change this ; variable in order to use PHP's session functions. ; ; As of PHP 4.0.1, you can define the path as: ; ; session.save_path = N;/path ; ; where N is an integer. Instead of storing all the session files in ; /path, what this will do is use subdirectories N-levels deep, and ; store the session data in those directories. This is useful if you ; or your OS have problems with lots of files in one directory, and is ; a more efficient layout for servers that handle lots of sessions. ; ; NOTE 1: PHP will not create this directory structure automatically. ; You can use the script in the ext/session dir for that purpose. ; NOTE 2: See the section on garbage collection below if
Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]
You say it's working on one box and not on the other? Maybe I'm wrong (and sounds like I am) but I thought that you couldn't pass objects between scripts even with serialize()? Certainly sounds like it was working for you... can anyone clarify what objects/variables/data types can be passed from script to script and what can't? I know things like database connections can't be shared (that is, you can't assign a MySQL connect link to a variable then pass that variable/connect to the next script, it needs to reconnect the next time around.. or am I wrong about that too? hah) -TG God I'm tired = = = Original message = = = Thought I'd give this another shot since I still can't figure it out after nearly a week... I have a gentoo server that doesn't save/restore the CLASS portion of a session, but it does retain other $_SESSION values. This code works fine on a debian box. WORKING BOX: [snip] ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help]
No no no. I'm NOT passing data between servers. It's just two pages on the same server. One that sets up the session/class and the other page just re-loads the session. When I talk about two different servers, I copy the entire source/db schema from one server to the other so they are clones for all intents and purposes. One server works the way I'd expect. The other doesn't. SAME code on both. Same schema. Nearly identical LAMP versions. This is why I'm saying, it's not my PHP code or database or anything like that. It must be some kind of server configuration, but I can't figure out what it would be. I've compared the php.ini files and don't see anything that seems relevant. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 24, 2006 4:54 PM To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Subject: Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! [second plead for help] You say it's working on one box and not on the other? Maybe I'm wrong (and sounds like I am) but I thought that you couldn't pass objects between scripts even with serialize()? Certainly sounds like it was working for you... can anyone clarify what objects/variables/data types can be passed from script to script and what can't? I know things like database connections can't be shared (that is, you can't assign a MySQL connect link to a variable then pass that variable/connect to the next script, it needs to reconnect the next time around.. or am I wrong about that too? hah) -TG God I'm tired = = = Original message = = = Thought I'd give this another shot since I still can't figure it out after nearly a week... I have a gentoo server that doesn't save/restore the CLASS portion of a session, but it does retain other $_SESSION values. This code works fine on a debian box. WORKING BOX: [snip] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?!
Thank you for the reply. I don't think that's the issue. I have: ; Initialize session on request startup. session.auto_start = 0 But this is the same setting as the box that DOES work. What's really confusing me is that part of the SESSION does work. I would expect an all or nothing case. Everything but the class is restored. You had me at EHLO --E.Webb (10.04.05) -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, January 19, 2006 1:54 PM To: Daevid Vincent Subject: Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! On Wed, January 18, 2006 11:27 pm, Daevid Vincent wrote: I have a gentoo server that doesn't save/restore the CLASS portion of a session, but it does retain other $_SESSION values. This code works Sounds to me like the Gentoo box does not have 'autoload' so the objects coming back out of the session have no 'class' to build themselves from... I confess to not reading all the details you posted to see if autoload was on/off differently in the two... Especially since I have no idea how to turn it on/off as I never used it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?!
Object 'autoload' has absolutely NOTHING to do with session.auto_start. http://www.php.net/autoload On Thu, January 19, 2006 4:10 pm, Daevid Vincent wrote: Thank you for the reply. I don't think that's the issue. I have: ; Initialize session on request startup. session.auto_start = 0 But this is the same setting as the box that DOES work. What's really confusing me is that part of the SESSION does work. I would expect an all or nothing case. Everything but the class is restored. You had me at EHLO --E.Webb (10.04.05) -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, January 19, 2006 1:54 PM To: Daevid Vincent Subject: Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! On Wed, January 18, 2006 11:27 pm, Daevid Vincent wrote: I have a gentoo server that doesn't save/restore the CLASS portion of a session, but it does retain other $_SESSION values. This code works Sounds to me like the Gentoo box does not have 'autoload' so the objects coming back out of the session have no 'class' to build themselves from... I confess to not reading all the details you posted to see if autoload was on/off differently in the two... Especially since I have no idea how to turn it on/off as I never used it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?!
You are correct, however that also seems to have to do with the actual class or php code and not a server configuration. If I copy my PHP files to the 'other' server, everything works as expected -- no change in code required. This is why I suspect it is a PHP/Apache/php.ini type of problem. But as I tried to illustrate, the php.ini seems to be nearly the same on both servers. -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, January 19, 2006 2:46 PM To: Daevid Vincent Cc: php-general@lists.php.net; [EMAIL PROTECTED] Subject: RE: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! Object 'autoload' has absolutely NOTHING to do with session.auto_start. http://www.php.net/autoload On Thu, January 19, 2006 4:10 pm, Daevid Vincent wrote: Thank you for the reply. I don't think that's the issue. I have: ; Initialize session on request startup. session.auto_start = 0 But this is the same setting as the box that DOES work. What's really confusing me is that part of the SESSION does work. I would expect an all or nothing case. Everything but the class is restored. You had me at EHLO --E.Webb (10.04.05) -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, January 19, 2006 1:54 PM To: Daevid Vincent Subject: Re: [PHP] $_SESSION saves all values but Class -- works on one server but not another?! On Wed, January 18, 2006 11:27 pm, Daevid Vincent wrote: I have a gentoo server that doesn't save/restore the CLASS portion of a session, but it does retain other $_SESSION values. This code works Sounds to me like the Gentoo box does not have 'autoload' so the objects coming back out of the session have no 'class' to build themselves from... I confess to not reading all the details you posted to see if autoload was on/off differently in the two... Especially since I have no idea how to turn it on/off as I never used it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION saves all values but Class -- works on one server but not another?!
I have a gentoo server that doesn't save/restore the CLASS portion of a session, but it does retain other $_SESSION values. This code works fine on a debian box. WORKING BOX: [EMAIL PROTECTED]:/lockdown# php --version PHP 5.0.3 (cli) (built: Jan 5 2006 13:18:18) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend Technologies with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend Technologies NOT WORKING BOX: vmware apache2-php5 # php --version PHP 5.0.5-pl3-gentoo (cli) (built: Dec 14 2005 15:44:04) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies I've compared the php.ini files and can't find anything related to sessions that is different. In fact they're almost the same with a few minor exceptions that should have no effect that I can think of. Here is the code I'm executing: ?php [SNIP DATABASE LOAD, ETC.] echo BUserData array = /BBR\n; print_r($UserData); //set the session variables: $_SESSION['login'] = true; $_SESSION['ie'] = (stristr($_SERVER['HTTP_USER_AGENT'],MSIE)) ? true : false; $_SESSION['id'] = $UserData['id']; $_SESSION['username'] = $UserData['username']; $_SESSION['firstname'] = $UserData['firstname']; $_SESSION['lastname'] = $UserData['lastname']; $_SESSION['email'] = $UserData['email']; $_SESSION['foo']= '1234567890'; require_once('includes/classes/User.class.php'); $_SESSION['user'] = new User($UserData['id']); echo PB_SESSION array = /BBR\n; var_dump($_SESSION); echo PBUSERNAME/B = .$_SESSION['user']-get_username().BR\n; exit; ? Which properly results in this (as it's all on the same page): UserData array = Array ( [id] = 1 [firstname] = Daevid [lastname] = Vincent [email] = [EMAIL PROTECTED] ) snip _SESSION array = array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1 [username]= string(6) daevid [firstname]= string(6) Daevid [lastname]= string(7) Vincent [email]= string(17) [EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]= object(User)#2 (24) { [username:protected]= string(6) daevid [firstname:protected]= string(6) Daevid [lastname:protected]= string(7) Vincent [email:protected]= string(17) [EMAIL PROTECTED] ... snip } } USERNAME = daevid Now I load a simple session loading test page with this code: ?php require_once('includes/classes/User.class.php'); session_start(); echo BSESSION TEST:P/B; var_dump($_SESSION); exit; ? On the working box things are fine (obviously): SESSION TEST: array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1 [username]= string(6) daevid [firstname]= string(6) Daevid [lastname]= string(7) Vincent [email]= string(17) [EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]= object(User)#1 (24) { [username:protected]= string(6) daevid [firstname:protected]= string(6) Daevid [lastname:protected]= string(7) Vincent [email:protected]= string(17) [EMAIL PROTECTED] [timestamp:protected]= string(19) -00-00 00:00:00 ... snip } } but on the broken box I see: SESSION TEST: array(9) { [login]= bool(true) [ie]= bool(true) [id]= string(1) 1 [username]= string(6) daevid [firstname]= string(6) Daevid [lastname]= string(7) Vincent [email]= string(17) [EMAIL PROTECTED] [foo]= string(10) 1234567890 [user]= object(User)#1 (20) { [username:protected]= string(0) [firstname:protected]= string(0) [lastname:protected]= string(0) [email:protected]= string(0) [timestamp:protected]= NULL ... snip } } Notice how the regular session info is there, but the User class is all empty or NULL. So SOME of the $_SESSION is working, but not the User class portion. This is completely baffling to me. Examining the /tmp/sess_* file shows this same data. Here is the session portion of php.ini on the broken box: [Session] ; Handler used to store/retrieve data. session.save_handler = files ; Argument passed to save_handler. In the case of files, this is the path ; where data files are stored. Note: Windows users have to change this ; variable in order to use PHP's session functions. ; ; As of PHP 4.0.1, you can define the path as: ; ; session.save_path = N;/path ; ; where N is an integer. Instead of storing all the session files in ; /path, what this will do is use subdirectories N-levels deep, and ; store the session data in those directories. This is useful if you ; or your OS have problems with lots of files in one directory, and is ; a more efficient layout for servers that handle lots of sessions. ; ; NOTE 1: PHP will not create this directory structure automatically. ; You can use the script in the ext/session dir for that purpose. ; NOTE 2: See the section on garbage collection below if you choose to ; use subdirectories for session storage ; ; The file storage module
Re: [PHP] $_SESSION and header()
On Sun, June 26, 2005 7:33 am, Alessandro Rosa said: (a) : After saving a couple of data into two $_SESSION variables from a form, (b) : I used the header() function to redirect the browser to (c) : display another page. (c) needs ?php session_start();? at the top, just like (a) and (b) and (z) for any other page you want to use your session data. Also, *WHY* redirect the browser and chew up an HTTP connection and make your application twice as slow? Plus, with the session_start() in there, you're going to duplicate all the effort you've already gone to to build up the session data structure (overhead). At that point in your script, you could just include (c) and be done with it. It's a heck of a lot easier to debug without feeling like you're the pinball in a fast-paced game of HTTP redirects, imho. You also make life easier on cURL and other programmatic access of your site, if you don't force them to play follow the bouncing ball to track down what they asked for. Just give it to them already. :-) I played with header(Location: ) in my early PHP days, and stopped using it rather quickly, unless I actually have a URL I want to maintain for the search engines for awhile, but the document has actually moved. Just because the re-direct works doesn't make it the best answer. Others on this list just LOVE to have a bunch of header(Location: ) statements in their PHP code, so you are not alone. Just something to think about. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION and header()
(a) : After saving a couple of data into two $_SESSION variables from a form, (b) : I used the header() function to redirect the browser to (c) : display another page. But, when I'm in the new page of (c), the $_SESSION variables stored in (a) are no longer available and I can get anymore their values then, (I can't say if they have been unset or erased). I presume there's some relation with the use of header() and the lost data. My intention is to keep the automatic redirection by the header(). Any suggestion? Thanks in advance. Alessandro Rosa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION and header()
On Sun, Jun 26, 2005 at 04:33:30PM +0200, Alessandro Rosa wrote: But, when I'm in the new page of (c), the $_SESSION variables stored in (a) are no longer available and I can get anymore their values then, (I can't say if they have been unset or erased). You have to pass the session ID between pages, either by setting session.use_cookies = 1 (so that the session ID is passed using a cookie where possible) or append the session ID to the URL you are redirecting to as part of the query parameters. Paul -- Rogue Tory http://www.roguetory.org.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION and header()
Does (c) have at the top of its page: ?php session_start(); ? André You have to pass the session ID between pages, either by setting session.use_cookies = 1 (so that the session ID is passed using a cookie where possible) or append the session ID to the URL you are redirecting to as part of the query parameters. Paul Thank you both! I did always use session_start() and finally I also already use the second option Paul addressed, in order to overcome the issues raised by header(). Not in the same terms, but the URL parameters was my idea too. So could I guess that this is there's no direct remedy to avoid header() delete sessions variables?:-) Alessandro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION
Hello all, i have a question concerning the $_SESSION stuff. i have a domain registered with online webspace on this webspace i have put a litte bit of code that will send the visitor's of the website to my server using a frame. I open one frame full-screen size and i let it open MY_IP/base/index.php as page. i then have a login page which uses $_SESSION and which sends you to either MY_IP/login1/index.php or MY_IP/login2/index.php depending on your username. (which are stored in mysql) this all works fine. i get redirected to the right page and all. but then on the new page the session doesn't work anymore. so the user gets a error for not being logged in and returns to the login page at /base AND here's the strange thing.. when i open it using the http://MY_IP link it all works great. it just doesn't when i use the frame via my hosting provider. So i tried to make a fram on my site which is exactly the same as the frame at the hosting provider. And it all works great aswell. just not when i place the frame at my Hosting Prov. has anybody got a clue how to do this? thanx Dennis
Re: [PHP] $_SESSION - Learning
there must be session_start() before your code have you check the $row-user, is it have value?? rgds [xm] http://amadarum.e-tics.net/nigritude-ultramarine.php - Original Message - From: Ross Bateman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, May 10, 2004 12:24 PM Subject: [PHP] $_SESSION - Learning Hi I am finally starting to try and use register_globals = off on my Servers. This means a lot of code that has to be checked and changed. Unfortunatly I am struggeling to come to grips with this new concept (new to me that is) and was wondering if anybody could give me some pointers. Getting stumped at my login script. Once I have checked user and passwords, I pass a few SESSION vars to use throughout my app. snip if ($status == 1) { //initiate a session session_start(); //register session variables $_SESSION['SESSION']; //Get DataBase details and connect to it include($root_path . include/vars.php); $query = SELECT * FROM admin WHERE user_name = '$user'; $result = mysql_query($query); $row = mysql_fetch_object($result); //include the username $_SESSION['SESSION_UNAME'] = $row-user; //include the user id $_SESSION['SESSION_UID'] = $row-admin_id; //set the SecLevel Session Var $_SESSION['SESSION_SEC'] = $row-sec_level; //Now do the redirect //redirect to Admin Page header(Location: ./admin_main.php); exit(); } else /snip Where ever I have the $SESSION['var_name'] I used to have a session_register(SESSION_VAR); $SESSION_VAR = $row-user; I then redirect to my app main page and check if a session is registerd to make sure a user is logged in: //check that each page is secure session_start(); //OLD CODE IN SCRIPT = if (!session_is_registered(SESSION)) if(isset($_SESSION['SESSION'])) { //if session check fails, invoke error handler header(Location: ./../error.php?e=2); exit(); } ? That all works fine, but when I finaly start to display data on the main page, nothing shows up. One of the things I try to display is the name of the user logged in: From the login script //include the username $_SESSION['SESSION_UNAME'] = $row-user; then on my main page echo logged in as b . $_SESSION['SESSION_UNAME'] . /b ; Needless to say, no data is displayed. anybody able to point out what I am getting wrong here. It used to work fine before the old way with register_globals = on. SIDE Note: On a Windows PC with Apache, PHP and MySQL installed, even with the register_globals = on set, the SESSION vars do not work. Thanks and sorry for the long post, Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION - Learning
Hi I am finally starting to try and use register_globals = off on my Servers. This means a lot of code that has to be checked and changed. Unfortunatly I am struggeling to come to grips with this new concept (new to me that is) and was wondering if anybody could give me some pointers. Getting stumped at my login script. Once I have checked user and passwords, I pass a few SESSION vars to use throughout my app. snip if ($status == 1) { //initiate a session session_start(); //register session variables $_SESSION['SESSION']; //Get DataBase details and connect to it include($root_path . include/vars.php); $query = SELECT * FROM admin WHERE user_name = '$user'; $result = mysql_query($query); $row = mysql_fetch_object($result); //include the username $_SESSION['SESSION_UNAME'] = $row-user; //include the user id $_SESSION['SESSION_UID'] = $row-admin_id; //set the SecLevel Session Var $_SESSION['SESSION_SEC'] = $row-sec_level; //Now do the redirect //redirect to Admin Page header(Location: ./admin_main.php); exit(); } else /snip Where ever I have the $SESSION['var_name'] I used to have a session_register(SESSION_VAR); $SESSION_VAR = $row-user; I then redirect to my app main page and check if a session is registerd to make sure a user is logged in: //check that each page is secure session_start(); //OLD CODE IN SCRIPT = if (!session_is_registered(SESSION)) if(isset($_SESSION['SESSION'])) { //if session check fails, invoke error handler header(Location: ./../error.php?e=2); exit(); } ? That all works fine, but when I finaly start to display data on the main page, nothing shows up. One of the things I try to display is the name of the user logged in: From the login script //include the username $_SESSION['SESSION_UNAME'] = $row-user; then on my main page echo logged in as b . $_SESSION['SESSION_UNAME'] . /b ; Needless to say, no data is displayed. anybody able to point out what I am getting wrong here. It used to work fine before the old way with register_globals = on. SIDE Note: On a Windows PC with Apache, PHP and MySQL installed, even with the register_globals = on set, the SESSION vars do not work. Thanks and sorry for the long post, Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION vs Database Call
Just wondering, what is faster / more effecient, storing a value in the session variable which gets stored on the filesystem (from what i understand) or database calls to re-get the information? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION vs Database Call
The difference between the two probably works out to less than 10 milliseconds on most servers, from a quick study that I ran on some HP servers that were brand new last summer, with the faster times using the filesystem. Course, the flexibility gained in managing the database version caused us to ask, would any of our users notice a 10 millisecond difference in response? Answer was; only the paranoid would notice the difference ;-). Course our user population was relatively small (100 - 500 concurrently signed on). Warren Vail -Original Message- From: Chris Thomas [mailto:[EMAIL PROTECTED] Sent: Thursday, March 25, 2004 3:19 PM To: [EMAIL PROTECTED] Subject: [PHP] $_SESSION vs Database Call Just wondering, what is faster / more effecient, storing a value in the session variable which gets stored on the filesystem (from what i understand) or database calls to re-get the information? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION vs Database Call
Vail, Warren mailto:[EMAIL PROTECTED] on Thursday, March 25, 2004 4:40 PM said: Answer was; only the paranoid would notice the difference ;-). Course our user population was relatively small (100 - 500 concurrently signed on). i don't even think rainman would notice 10 milliseconds. chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION
I've got a question that I'm sure has a simple answer. Why aren't my session objects transferring across more than one page? I'm calling a session object that was set in the page prior; $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj']; I then assign a variable that value; $myvar = $_SESSION['mysessionvar']; echo $myvar; This displays like I expected. However when I go to the next page and want to display this var again I get either an Undefined index or variable. According to the docs $_SESSION[] is now global and this is the way of setting and retrieving session objects, right? I have tried calling that session object again but it's empty and so is the variable. I thought that the session would stay open until I close the browser and I could return those values any time I wanted. Am I missing something? alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
RE: [PHP] $_SESSION
You need to call session_start() on each page. -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: January 20, 2004 1:29 PM To: PHP General list Subject: [PHP] $_SESSION I've got a question that I'm sure has a simple answer. Why aren't my session objects transferring across more than one page? I'm calling a session object that was set in the page prior; $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj']; I then assign a variable that value; $myvar = $_SESSION['mysessionvar']; echo $myvar; This displays like I expected. However when I go to the next page and want to display this var again I get either an Undefined index or variable. According to the docs $_SESSION[] is now global and this is the way of setting and retrieving session objects, right? I have tried calling that session object again but it's empty and so is the variable. I thought that the session would stay open until I close the browser and I could return those values any time I wanted. Am I missing something? alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION
Yeah..., I tried that. I got back an error that read; Warning: session_start(): Cannot send session cookie - headers already sent by Warning: session_start(): Cannot send session cache limiter - headers already sent. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 12:31 PM To: 'Alex Hogan'; 'PHP General list' Subject: RE: [PHP] $_SESSION You need to call session_start() on each page. -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: January 20, 2004 1:29 PM To: PHP General list Subject: [PHP] $_SESSION I've got a question that I'm sure has a simple answer. Why aren't my session objects transferring across more than one page? I'm calling a session object that was set in the page prior; $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj']; I then assign a variable that value; $myvar = $_SESSION['mysessionvar']; echo $myvar; This displays like I expected. However when I go to the next page and want to display this var again I get either an Undefined index or variable. According to the docs $_SESSION[] is now global and this is the way of setting and retrieving session objects, right? I have tried calling that session object again but it's empty and so is the variable. I thought that the session would stay open until I close the browser and I could return those values any time I wanted. Am I missing something? alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ** ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
RE: [PHP] $_SESSION
You have to put it at the top of the page prior to anything else. ?php session_start(); //proceed with other code ? -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: January 20, 2004 1:45 PM To: 'PHP General list' Subject: RE: [PHP] $_SESSION Yeah..., I tried that. I got back an error that read; Warning: session_start(): Cannot send session cookie - headers already sent by Warning: session_start(): Cannot send session cache limiter - headers already sent. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 12:31 PM To: 'Alex Hogan'; 'PHP General list' Subject: RE: [PHP] $_SESSION You need to call session_start() on each page. -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: January 20, 2004 1:29 PM To: PHP General list Subject: [PHP] $_SESSION I've got a question that I'm sure has a simple answer. Why aren't my session objects transferring across more than one page? I'm calling a session object that was set in the page prior; $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj']; I then assign a variable that value; $myvar = $_SESSION['mysessionvar']; echo $myvar; This displays like I expected. However when I go to the next page and want to display this var again I get either an Undefined index or variable. According to the docs $_SESSION[] is now global and this is the way of setting and retrieving session objects, right? I have tried calling that session object again but it's empty and so is the variable. I thought that the session would stay open until I close the browser and I could return those values any time I wanted. Am I missing something? alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ** ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION
Alex Hogan wrote: I got back an error that read; Warning: session_start(): Cannot send session cookie - headers already sent by Warning: session_start(): Cannot send session cache limiter - headers already sent. You need to use session_start() before any headers are written. -Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_SESSION
Oopps, my bad. sorry. That worked like a champ... Thanks..., I'll sulk off now... -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 12:46 PM To: 'Alex Hogan'; 'PHP General list' Subject: RE: [PHP] $_SESSION You have to put it at the top of the page prior to anything else. ?php session_start(); //proceed with other code ? -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: January 20, 2004 1:45 PM To: 'PHP General list' Subject: RE: [PHP] $_SESSION Yeah..., I tried that. I got back an error that read; Warning: session_start(): Cannot send session cookie - headers already sent by Warning: session_start(): Cannot send session cache limiter - headers already sent. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 12:31 PM To: 'Alex Hogan'; 'PHP General list' Subject: RE: [PHP] $_SESSION You need to call session_start() on each page. -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: January 20, 2004 1:29 PM To: PHP General list Subject: [PHP] $_SESSION I've got a question that I'm sure has a simple answer. Why aren't my session objects transferring across more than one page? I'm calling a session object that was set in the page prior; $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj']; I then assign a variable that value; $myvar = $_SESSION['mysessionvar']; echo $myvar; This displays like I expected. However when I go to the next page and want to display this var again I get either an Undefined index or variable. According to the docs $_SESSION[] is now global and this is the way of setting and retrieving session objects, right? I have tried calling that session object again but it's empty and so is the variable. I thought that the session would stay open until I close the browser and I could return those values any time I wanted. Am I missing something? alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ** ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ** ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
RE: [PHP] $_SESSION
Hey, Make sure its right on top of the pagejust at the start of your ?php before even calling a include or require etc HTH. -Ryan On 1/20/2004 7:44:31 PM, [EMAIL PROTECTED] wrote: Yeah..., I tried that. I got back an error that read; Warning: session_start(): Cannot send session cookie - headers already sent by Warning: session_start(): Cannot send session cache limiter - headers already sent. -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 12:31 PM To: 'Alex Hogan'; 'PHP General list' Subject: RE: [PHP] $_SESSION You need to call session_start() on each page. -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: January 20, 2004 1:29 PM To: PHP General list Subject: [PHP] $_SESSION I've got a question that I'm sure has a simple answer. Why aren't my session objects transferring across more than one page? I'm calling a session object that was set in the page prior; $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj']; I then assign a variable that value; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION
Alex Hogan wrote: I've got a question that I'm sure has a simple answer. Why aren't my session objects transferring across more than one page? I'm calling a session object that was set in the page prior; $_SESSION['mysessionvar'] = $_REQUEST['mytxtobj']; I then assign a variable that value; $myvar = $_SESSION['mysessionvar']; echo $myvar; This displays like I expected. However when I go to the next page and want to display this var again I get either an Undefined index or variable. According to the docs $_SESSION[] is now global and this is the way of setting and retrieving session objects, right? I have tried calling that session object again but it's empty and so is the variable. I thought that the session would stay open until I close the browser and I could return those values any time I wanted. Am I missing something? Are you starting the session on each page? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP $_SESSION Expiring in IE
Hello, I have recently launched the new Planet-Tolkien.com, one would think that writing a message board from scratch and a dynamic weather system, a simple session login would be the least of my problems right? Wrong. It would appear that for Mozilla and Opera keep a $_SESSION is not an issue and the $_SESSION is continued until the member logs out. However when members are using Internet Explorer browser (most versions it seems), they can go around the site for varied amounts of time, usually less than five minutes and then their $_SESSION will expire!!?? I cannot for the life of me figure out why a server side $_SESSION would expire on IE but not for MOZ or Opera but it is, and I need to figure out why and how can I fix this. REF. All login information is saved as such: session_save_path($path/sessions); session_start(); $_SESSION['session_memberID']=$session_memberID; $_SESSION['session_username']=$session_username; $_SESSION['session_groupID']=$membergroup; In Fellowship, Tarrant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP $_SESSION Expiring in IE
I use sessions with IE all the time without such a problem. Are there any points in the program that redirect the user off site and back or something with that affect that IE might be handling in a wierd way? Do you have pages that detect the browser and feed alternate content based on the browser? If so do you always run the session_start before these checks? -Original Message- From: Tarrant Costelloe [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 10:27 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP $_SESSION Expiring in IE Hello, I have recently launched the new Planet-Tolkien.com, one would think that writing a message board from scratch and a dynamic weather system, a simple session login would be the least of my problems right? Wrong. It would appear that for Mozilla and Opera keep a $_SESSION is not an issue and the $_SESSION is continued until the member logs out. However when members are using Internet Explorer browser (most versions it seems), they can go around the site for varied amounts of time, usually less than five minutes and then their $_SESSION will expire!!?? I cannot for the life of me figure out why a server side $_SESSION would expire on IE but not for MOZ or Opera but it is, and I need to figure out why and how can I fix this. REF. All login information is saved as such: session_save_path($path/sessions); session_start(); $_SESSION['session_memberID']=$session_memberID; $_SESSION['session_username']=$session_username; $_SESSION['session_groupID']=$membergroup; In Fellowship, Tarrant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP $_SESSION Expiring in IE
Are there any points in the program that redirect the user off site and back or something with that affect that IE might be handling in a weird way? Nope Do you have pages that detect the browser and feed alternate content based on the browser? Nope do you always run the session_start before these checks? Yes. The only other thing I guess it could be is the .htaccess mod_rewrite maybe? It's just weird that Internet Explorer is the only browser that seemingly looses the members $_SESSION where as Mozilla is not effected whatsoever. In Fellowship, Tarrant -Original Message- From: Larry Brown [mailto:[EMAIL PROTECTED] Sent: 03 January 2004 16:34 To: Tarrant Costelloe; PHP List Subject: RE: [PHP] PHP $_SESSION Expiring in IE I use sessions with IE all the time without such a problem. Are there any points in the program that redirect the user off site and back or something with that affect that IE might be handling in a wierd way? Do you have pages that detect the browser and feed alternate content based on the browser? If so do you always run the session_start before these checks? -Original Message- From: Tarrant Costelloe [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 10:27 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP $_SESSION Expiring in IE Hello, I have recently launched the new Planet-Tolkien.com, one would think that writing a message board from scratch and a dynamic weather system, a simple session login would be the least of my problems right? Wrong. It would appear that for Mozilla and Opera keep a $_SESSION is not an issue and the $_SESSION is continued until the member logs out. However when members are using Internet Explorer browser (most versions it seems), they can go around the site for varied amounts of time, usually less than five minutes and then their $_SESSION will expire!!?? I cannot for the life of me figure out why a server side $_SESSION would expire on IE but not for MOZ or Opera but it is, and I need to figure out why and how can I fix this. REF. All login information is saved as such: session_save_path($path/sessions); session_start(); $_SESSION['session_memberID']=$session_memberID; $_SESSION['session_username']=$session_username; $_SESSION['session_groupID']=$membergroup; In Fellowship, Tarrant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP $_SESSION Expiring in IE
Have you tried the header(Cache-control: private) workaround for IE6? I seem to remember reading something about that on one of the web dev sites (devshed probably). Use that immediately after session_start() and see if it makes a difference. Kirk Tarrant Costelloe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Are there any points in the program that redirect the user off site and back or something with that affect that IE might be handling in a weird way? Nope Do you have pages that detect the browser and feed alternate content based on the browser? Nope do you always run the session_start before these checks? Yes. The only other thing I guess it could be is the .htaccess mod_rewrite maybe? It's just weird that Internet Explorer is the only browser that seemingly looses the members $_SESSION where as Mozilla is not effected whatsoever. In Fellowship, Tarrant -Original Message- From: Larry Brown [mailto:[EMAIL PROTECTED] Sent: 03 January 2004 16:34 To: Tarrant Costelloe; PHP List Subject: RE: [PHP] PHP $_SESSION Expiring in IE I use sessions with IE all the time without such a problem. Are there any points in the program that redirect the user off site and back or something with that affect that IE might be handling in a wierd way? Do you have pages that detect the browser and feed alternate content based on the browser? If so do you always run the session_start before these checks? -Original Message- From: Tarrant Costelloe [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 10:27 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP $_SESSION Expiring in IE Hello, I have recently launched the new Planet-Tolkien.com, one would think that writing a message board from scratch and a dynamic weather system, a simple session login would be the least of my problems right? Wrong. It would appear that for Mozilla and Opera keep a $_SESSION is not an issue and the $_SESSION is continued until the member logs out. However when members are using Internet Explorer browser (most versions it seems), they can go around the site for varied amounts of time, usually less than five minutes and then their $_SESSION will expire!!?? I cannot for the life of me figure out why a server side $_SESSION would expire on IE but not for MOZ or Opera but it is, and I need to figure out why and how can I fix this. REF. All login information is saved as such: session_save_path($path/sessions); session_start(); $_SESSION['session_memberID']=$session_memberID; $_SESSION['session_username']=$session_username; $_SESSION['session_groupID']=$membergroup; In Fellowship, Tarrant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP $_SESSION Expiring in IE
Doesn't seem to have solved the problem... My session include file at the top of all documents looks like: session_save_path($some_path/sessions); ini_set('session.use_cookies', 1); ini_set('session.gc_probability', 1); ini_set('session.gc_maxlifetime', 60 * 60); ini_set('session.auto_start', '1'); session_start(); header(Cache-control: private); Here is a link to my PHP configuration: http://www.planet-tolkien.com/test.php In Fellowship, Tarrant -Original Message- From: Kirk Babb [mailto:[EMAIL PROTECTED] Sent: 03 January 2004 21:13 To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP $_SESSION Expiring in IE Have you tried the header(Cache-control: private) workaround for IE6? I seem to remember reading something about that on one of the web dev sites (devshed probably). Use that immediately after session_start() and see if it makes a difference. Kirk Tarrant Costelloe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Are there any points in the program that redirect the user off site and back or something with that affect that IE might be handling in a weird way? Nope Do you have pages that detect the browser and feed alternate content based on the browser? Nope do you always run the session_start before these checks? Yes. The only other thing I guess it could be is the .htaccess mod_rewrite maybe? It's just weird that Internet Explorer is the only browser that seemingly looses the members $_SESSION where as Mozilla is not effected whatsoever. In Fellowship, Tarrant -Original Message- From: Larry Brown [mailto:[EMAIL PROTECTED] Sent: 03 January 2004 16:34 To: Tarrant Costelloe; PHP List Subject: RE: [PHP] PHP $_SESSION Expiring in IE I use sessions with IE all the time without such a problem. Are there any points in the program that redirect the user off site and back or something with that affect that IE might be handling in a wierd way? Do you have pages that detect the browser and feed alternate content based on the browser? If so do you always run the session_start before these checks? -Original Message- From: Tarrant Costelloe [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 10:27 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP $_SESSION Expiring in IE Hello, I have recently launched the new Planet-Tolkien.com, one would think that writing a message board from scratch and a dynamic weather system, a simple session login would be the least of my problems right? Wrong. It would appear that for Mozilla and Opera keep a $_SESSION is not an issue and the $_SESSION is continued until the member logs out. However when members are using Internet Explorer browser (most versions it seems), they can go around the site for varied amounts of time, usually less than five minutes and then their $_SESSION will expire!!?? I cannot for the life of me figure out why a server side $_SESSION would expire on IE but not for MOZ or Opera but it is, and I need to figure out why and how can I fix this. REF. All login information is saved as such: session_save_path($path/sessions); session_start(); $_SESSION['session_memberID']=$session_memberID; $_SESSION['session_username']=$session_username; $_SESSION['session_groupID']=$membergroup; In Fellowship, Tarrant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP $_SESSION Expiring in IE
IE and Moz have different JAVA script engines. Try turning off JAVA and see if IE maintains it's session. Tarrant Costelloe wrote: Hello, I have recently launched the new Planet-Tolkien.com, one would think that writing a message board from scratch and a dynamic weather system, a simple session login would be the least of my problems right? Wrong. It would appear that for Mozilla and Opera keep a $_SESSION is not an issue and the $_SESSION is continued until the member logs out. However when members are using Internet Explorer browser (most versions it seems), they can go around the site for varied amounts of time, usually less than five minutes and then their $_SESSION will expire!!?? I cannot for the life of me figure out why a server side $_SESSION would expire on IE but not for MOZ or Opera but it is, and I need to figure out why and how can I fix this. REF. All login information is saved as such: session_save_path($path/sessions); session_start(); $_SESSION['session_memberID']=$session_memberID; $_SESSION['session_username']=$session_username; $_SESSION['session_groupID']=$membergroup; In Fellowship, Tarrant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP $_SESSION Expiring in IE
Guess I'm being nosy here, so forgive me, but why are you settting an alternate save path and using ini_set at the start of each document? I know that has nothing to do with the problem, but I was just wondering. Are you hosting multiple sites off your server and have different session settings depending on the site? -Kirk session_save_path($some_path/sessions); ini_set('session.use_cookies', 1); ini_set('session.gc_probability', 1); ini_set('session.gc_maxlifetime', 60 * 60); ini_set('session.auto_start', '1'); session_start(); header(Cache-control: private); Here is a link to my PHP configuration: http://www.planet-tolkien.com/test.php In Fellowship, Tarrant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php