Results 1 to 7 of 7

Thread: Server Side Include generates session_start error

  1. #1
    Ray Campbell
    Guest

    Default Server Side Include generates session_start error

    Hi.

    It's me again, out on a limb sawing away between me and the tree. This may
    be a little OT, but hoping it's an easy enough tweak.

    I am attempting to eliminate an I-Frame by using a server side include.
    Simply using a text box, and inserting the following PHP:

    <?php include("../../glossary/index.php") ?>

    I've done it successfully with one script I'm using, but this one is giving
    me grief. When I load the page, I get the following error displayed:

    Warning: session_start() [function.session-start]:
    Cannot send session cache limiter - headers already sent
    (output started at /server/path/iglossary.php:10) in
    /server/path/config.inc.php on line 11

    Below that, the script seems to do it's job.

    I commented out the following line in the config.inc.php file for the
    script:

    //session_start();

    and that seems to have removed the error, but I'm wondering if I'm asking
    for trouble by doing this. If it makes any difference, this page will be
    accessed from a secure section of the site, so no doubt a session will
    already have been started.

    Any insights appreciated.

    -RayC


  2. #2
    Derek
    Guest

    Default Re: Server Side Include generates session_start error

    On 18/03/2010 14:38, Ray Campbell wrote:

    > Simply using a text box, and inserting the following PHP:
    >
    > <?php include("../../glossary/index.php") ?>
    >

    ....
    >
    > Warning: session_start() [function.session-start]:
    > Cannot send session cache limiter - headers already sent
    > (output started at /server/path/iglossary.php:10) in
    > /server/path/config.inc.php on line 11
    >


    Ray,

    Found a comment on the PHP manual page
    (http://php.net/manual/en/function.session-start.php - see comment from
    LaurenceJ44); long & short is that the <?php session_start(); ?> needs
    to be the first line in the php file (yours would appear to be line 11).

    HTH

    Derek

  3. #3
    Ray Campbell
    Guest

    Default Re: Server Side Include generates session_start error


    "Derek" <no.reply@who.cares> wrote in message
    news:hnu2md$59c$1@DailyPlanet.news.netobjects.com. ..
    > On 18/03/2010 14:38, Ray Campbell wrote:
    >
    >> Simply using a text box, and inserting the following PHP:
    >>
    >> <?php include("../../glossary/index.php") ?>
    >>

    > ...
    >>
    >> Warning: session_start() [function.session-start]:
    >> Cannot send session cache limiter - headers already sent
    >> (output started at /server/path/iglossary.php:10) in
    >> /server/path/config.inc.php on line 11
    >>

    >
    > Ray,
    >
    > Found a comment on the PHP manual page
    > (http://php.net/manual/en/function.session-start.php - see comment from
    > LaurenceJ44); long & short is that the <?php session_start(); ?> needs to
    > be the first line in the php file (yours would appear to be line 11).
    >
    > HTH
    >
    > Derek



    Interesting. I think I actually stumbled upon that thread as I googled
    about, but didn't read that far.

    So, let me lay this out:
    * The first line in the index.php file of the script is an include for the
    config.inc.php
    * In config.inc.php, after a few variable assignments, the first line is,
    indeed, the session_start() command.
    * So, if the script were running stand-alone (assuming variable assignments
    don't count), the first instruction would be session_start().

    Obviously, once I'm doing an "include" on the script, the entire NOF page
    becomes a .PHP page, so it would seem that session_start() moves lower in
    the page.

    So... should delete session_start() from the script, and insert
    session_start() in the NOF page at the top?

    I'll go ahead and try it when I'm back at my NOF computer, but thought I'd
    throw it out there, if anyone cares to weigh in.

    -RayC




  4. #4
    Max
    Guest

    Default Re: Server Side Include generates session_start error

    session_start() must literally be the first piece of code on the page,
    even before the DOCTYPE.

    i.e. your page needs to start:


    <?php
    session_start();
    include("myinclude.inc.php");
    ?>
    <!DOCTYPE html PUBLIC .............


    That means manually adding the code after NOF has generated the page -
    at least that's the way I've found it works.

    Max

    ----
    Ray Campbell wrote:
    > "Derek" <no.reply@who.cares> wrote in message
    > news:hnu2md$59c$1@DailyPlanet.news.netobjects.com. ..
    >> On 18/03/2010 14:38, Ray Campbell wrote:
    >>
    >>> Simply using a text box, and inserting the following PHP:
    >>>
    >>> <?php include("../../glossary/index.php") ?>
    >>>

    >> ...
    >>> Warning: session_start() [function.session-start]:
    >>> Cannot send session cache limiter - headers already sent
    >>> (output started at /server/path/iglossary.php:10) in
    >>> /server/path/config.inc.php on line 11
    >>>

    >> Ray,
    >>
    >> Found a comment on the PHP manual page
    >> (http://php.net/manual/en/function.session-start.php - see comment from
    >> LaurenceJ44); long & short is that the <?php session_start(); ?> needs to
    >> be the first line in the php file (yours would appear to be line 11).
    >>
    >> HTH
    >>
    >> Derek

    >
    >
    > Interesting. I think I actually stumbled upon that thread as I googled
    > about, but didn't read that far.
    >
    > So, let me lay this out:
    > * The first line in the index.php file of the script is an include for the
    > config.inc.php
    > * In config.inc.php, after a few variable assignments, the first line is,
    > indeed, the session_start() command.
    > * So, if the script were running stand-alone (assuming variable assignments
    > don't count), the first instruction would be session_start().
    >
    > Obviously, once I'm doing an "include" on the script, the entire NOF page
    > becomes a .PHP page, so it would seem that session_start() moves lower in
    > the page.
    >
    > So... should delete session_start() from the script, and insert
    > session_start() in the NOF page at the top?
    >
    > I'll go ahead and try it when I'm back at my NOF computer, but thought I'd
    > throw it out there, if anyone cares to weigh in.
    >
    > -RayC
    >
    >
    >


  5. #5
    Chuck Joslin
    Guest

    Default Re: Server Side Include generates session_start error

    Yes, a session start must be the first line in the page.

    No need to manually edit though.

    You can do this in the Object HTML for the Layout or Master Border (if you
    need a session start on every page) in Page Design View.

    A session start either starts a session or maintains one already started.

    For those who may be wondering, a session allows you to have persistent
    variables from page to page that can be used in whatever manner you wish.

    Like spreading a form across multiple pages, for example.

    --
    Chuck Joslin
    BeyondFusion.com - Your Fusion Community
    www.beyondfusion.com

    Register domain names at www.awavedomains.com


    "Max" <max@domain.invalid> wrote in message
    news:hnubn7$9g9$1@DailyPlanet.news.netobjects.com. ..
    > session_start() must literally be the first piece of code on the page,
    > even before the DOCTYPE.
    >
    > i.e. your page needs to start:
    >
    >
    > <?php
    > session_start();
    > include("myinclude.inc.php");
    > ?>
    > <!DOCTYPE html PUBLIC .............
    >
    >
    > That means manually adding the code after NOF has generated the page - at
    > least that's the way I've found it works.
    >
    > Max
    >
    > ----
    > Ray Campbell wrote:
    >> "Derek" <no.reply@who.cares> wrote in message
    >> news:hnu2md$59c$1@DailyPlanet.news.netobjects.com. ..
    >>> On 18/03/2010 14:38, Ray Campbell wrote:
    >>>
    >>>> Simply using a text box, and inserting the following PHP:
    >>>>
    >>>> <?php include("../../glossary/index.php") ?>
    >>>>
    >>> ...
    >>>> Warning: session_start() [function.session-start]:
    >>>> Cannot send session cache limiter - headers already sent
    >>>> (output started at /server/path/iglossary.php:10) in
    >>>> /server/path/config.inc.php on line 11
    >>>>
    >>> Ray,
    >>>
    >>> Found a comment on the PHP manual page
    >>> (http://php.net/manual/en/function.session-start.php - see comment from
    >>> LaurenceJ44); long & short is that the <?php session_start(); ?> needs
    >>> to be the first line in the php file (yours would appear to be line 11).
    >>>
    >>> HTH
    >>>
    >>> Derek

    >>
    >>
    >> Interesting. I think I actually stumbled upon that thread as I googled
    >> about, but didn't read that far.
    >>
    >> So, let me lay this out:
    >> * The first line in the index.php file of the script is an include for
    >> the config.inc.php
    >> * In config.inc.php, after a few variable assignments, the first line is,
    >> indeed, the session_start() command.
    >> * So, if the script were running stand-alone (assuming variable
    >> assignments don't count), the first instruction would be session_start().
    >>
    >> Obviously, once I'm doing an "include" on the script, the entire NOF page
    >> becomes a .PHP page, so it would seem that session_start() moves lower in
    >> the page.
    >>
    >> So... should delete session_start() from the script, and insert
    >> session_start() in the NOF page at the top?
    >>
    >> I'll go ahead and try it when I'm back at my NOF computer, but thought
    >> I'd throw it out there, if anyone cares to weigh in.
    >>
    >> -RayC
    >>
    >>
    >>


  6. #6
    Ray Campbell
    Guest

    Default Re: Server Side Include generates session_start error

    Well, I figured out what the instruction was for... with the instruction
    commented out I couldn't log into the admin section of the script. Makes
    sense.

    Thanks all for educating me on this a bit. I'll have to experiment a bit to
    see what works, but at least I have something to go on.

    -RayC


    "Chuck Joslin" <chuckno@spambeyondfusion.com> wrote in message
    news:hnuc5r$9qt$1@DailyPlanet.news.netobjects.com. ..
    > Yes, a session start must be the first line in the page.
    >
    > No need to manually edit though.
    >
    > You can do this in the Object HTML for the Layout or Master Border (if you
    > need a session start on every page) in Page Design View.
    >
    > A session start either starts a session or maintains one already started.
    >
    > For those who may be wondering, a session allows you to have persistent
    > variables from page to page that can be used in whatever manner you wish.
    >
    > Like spreading a form across multiple pages, for example.
    >
    > --
    > Chuck Joslin
    > BeyondFusion.com - Your Fusion Community
    > www.beyondfusion.com
    >
    > Register domain names at www.awavedomains.com
    >
    >
    > "Max" <max@domain.invalid> wrote in message
    > news:hnubn7$9g9$1@DailyPlanet.news.netobjects.com. ..
    >> session_start() must literally be the first piece of code on the page,
    >> even before the DOCTYPE.
    >>
    >> i.e. your page needs to start:
    >>
    >>
    >> <?php
    >> session_start();
    >> include("myinclude.inc.php");
    >> ?>
    >> <!DOCTYPE html PUBLIC .............
    >>
    >>
    >> That means manually adding the code after NOF has generated the page - at
    >> least that's the way I've found it works.
    >>
    >> Max
    >>
    >> ----
    >> Ray Campbell wrote:
    >>> "Derek" <no.reply@who.cares> wrote in message
    >>> news:hnu2md$59c$1@DailyPlanet.news.netobjects.com. ..
    >>>> On 18/03/2010 14:38, Ray Campbell wrote:
    >>>>
    >>>>> Simply using a text box, and inserting the following PHP:
    >>>>>
    >>>>> <?php include("../../glossary/index.php") ?>
    >>>>>
    >>>> ...
    >>>>> Warning: session_start() [function.session-start]:
    >>>>> Cannot send session cache limiter - headers already sent
    >>>>> (output started at /server/path/iglossary.php:10) in
    >>>>> /server/path/config.inc.php on line 11
    >>>>>
    >>>> Ray,
    >>>>
    >>>> Found a comment on the PHP manual page
    >>>> (http://php.net/manual/en/function.session-start.php - see comment from
    >>>> LaurenceJ44); long & short is that the <?php session_start(); ?> needs
    >>>> to be the first line in the php file (yours would appear to be line
    >>>> 11).
    >>>>
    >>>> HTH
    >>>>
    >>>> Derek
    >>>
    >>>
    >>> Interesting. I think I actually stumbled upon that thread as I googled
    >>> about, but didn't read that far.
    >>>
    >>> So, let me lay this out:
    >>> * The first line in the index.php file of the script is an include for
    >>> the config.inc.php
    >>> * In config.inc.php, after a few variable assignments, the first line
    >>> is, indeed, the session_start() command.
    >>> * So, if the script were running stand-alone (assuming variable
    >>> assignments don't count), the first instruction would be
    >>> session_start().
    >>>
    >>> Obviously, once I'm doing an "include" on the script, the entire NOF
    >>> page becomes a .PHP page, so it would seem that session_start() moves
    >>> lower in the page.
    >>>
    >>> So... should delete session_start() from the script, and insert
    >>> session_start() in the NOF page at the top?
    >>>
    >>> I'll go ahead and try it when I'm back at my NOF computer, but thought
    >>> I'd throw it out there, if anyone cares to weigh in.
    >>>
    >>> -RayC
    >>>
    >>>
    >>>




  7. #7
    Ray Campbell
    Guest

    Default Re: Server Side Include generates session_start error

    Hey, all.

    Just thought I would report back with my results.

    In "Layout Properties" I clicked [HTML] and inserted:

    <?php session_start(); ?>

    I used Layout Properties rather than MasterBorder Properties because I only
    need this on this one page.

    I am now error-free!

    I have even removed the comment tag in the original script, leaving the
    original session_start(); in place with no problem. This is good, since it
    leaves the script un-modified, and it will still execute properly as a
    stand-alone page.

    Thanks, all.

    -RayC

    "Ray Campbell" <crayz@SPAMMENOT.amonavi.com> wrote in message
    news:hnte99$rdd$1@DailyPlanet.news.netobjects.com. ..
    > Hi.
    >
    > It's me again, out on a limb sawing away between me and the tree. This may
    > be a little OT, but hoping it's an easy enough tweak.
    >
    > I am attempting to eliminate an I-Frame by using a server side include.
    > Simply using a text box, and inserting the following PHP:
    >
    > <?php include("../../glossary/index.php") ?>
    >
    > I've done it successfully with one script I'm using, but this one is
    > giving me grief. When I load the page, I get the following error
    > displayed:
    >
    > Warning: session_start() [function.session-start]:
    > Cannot send session cache limiter - headers already sent
    > (output started at /server/path/iglossary.php:10) in
    > /server/path/config.inc.php on line 11
    >
    > Below that, the script seems to do it's job.
    >
    > I commented out the following line in the config.inc.php file for the
    > script:
    >
    > //session_start();
    >
    > and that seems to have removed the error, but I'm wondering if I'm asking
    > for trouble by doing this. If it makes any difference, this page will be
    > accessed from a secure section of the site, so no doubt a session will
    > already have been started.
    >
    > Any insights appreciated.
    >
    > -RayC



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •