Re: ob_start & session_start

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sure, ob_start begins a buffer allowing you to display content in the
browser before your script has finished executing.  This is useful when
loading a time intensive page to tell the user to wait.  When you create a
session (provide php is not configured otherwise) php attempts to store a
cookie with the session id that corisponds to the session file on the
server.  If it cannot set this cookie it appends the session id to pages in
the get format.  If you were to call session_start() after the output
buffering, content and consequentially the headers would have been already
sent to the browser.  Since cookies must be set in the headers and the
headers must be set before any content is sent to the page, to use cookie
based sessions you must begin the session before the buffer.

Hope that cleared it up,

Zack Bloom


 On 12/8/05, Chris Shiflett <shiflett@xxxxxxx> wrote:
>
> Joe Harman wrote:
> > Okay...makes sense after you spelled it out to me.
>
> That didn't make sense to me (and I missed the original reply). Mind
> elaborating? :-)
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
>
> --
> PHP General Mailing List ( http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux