Forum Moderators: coopster

Message Too Old, No Replies

php 5 sessions

         

electricocean

12:45 am on Jun 3, 2005 (gmt 0)

10+ Year Member



Hi,

me and my friend just got a server up and running php 5. We origannly had php 4 but then we put all of the stuff on the new server. We now get errors when we use session_start(); Does it start automatically or do I need to set somethinf in php.ini?

thanks,
electricocean

coopster

1:02 pm on Jun 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



They can be started automatically by changing directives in the configuration, but most default configurations do not operate as such. What are the error messages you are getting?

RootAdmen

9:58 pm on Jun 3, 2005 (gmt 0)

10+ Year Member



My mistake, I had missread the error message, on php4 the session was started in an include file half way though the code, but in php5 i guess it wanted befor some other code we had, but I'm not sure why, it wasent refering to the session at all, o well
-Root admen, with eletricocean

coopster

11:26 pm on Jun 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, RootAdmen.

JamShady

3:42 am on Jun 6, 2005 (gmt 0)

10+ Year Member



Sessions need to be started before any output is sent to the browser. This is because it sends cookies in the headers, which it can't do after content is sent. The exception to this is when you have output buffering enabled, which is where PHP is actually storing the output until the end of the script (or you flush it within the code). Because PHP is holding the data back, you can still send headers afterwards, PHP will make sure to send them before it sends the page contents.