Common session_start() error..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • IchBin

    Common session_start() error..

    I am getting the error message below when ever I try to start my script
    on two different servers. I am not getting any errors off of my PC. I
    have looked around and found the answer a simple one. I can not stop the
    error in my script. The session_start() is the first thing that happens
    before any Headers are created. Any one have any suggestions. Include
    the start of the code that uses the session var.


    Warning: session_start() : Cannot send session cookie - headers already
    sent by (output started at
    /home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php:1) in
    /home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php on line 8

    Warning: session_start() : Cannot send session cache limiter - headers
    already sent (output started at
    /home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php:1) in
    /home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php on line 8

    <?php
    /**
    *
    *
    * @version $Id$
    * @copyright 2006
    */
    session_start() ;
    if(!isset($_SES SION['abbr_letter']))
    $_SESSION['abbr_letter'] = 'A';

    require_once 'includes/config.inc.php' ;
    require_once 'includes/header.inc.php' ;
    //
    // Start a Form
    ?>
    <html>
    <head>
    <style type="text/css" >
    body {
    margin-left: 10%; margin-right: 10%;
    color: purple;
    background-color: #FFFFF2;
    }
    quote{ background-color: white }
    </style>
    </head>
    <b><FORM NAME="author_ab brv" method="POST" action="<?php echo
    $_SERVER['PHP_SELF'];?>"></b>
    <input type="radio" name="abbr_lett er" value="A" checked="TRUE"
    onclick="submit ()"A
    <input type="radio" name="abbr_lett er" value="B" onclick="submit ()"B
    <input type="radio" name="abbr_lett er" value="C" onclick="submit ()"C
    <input type="radio" name="abbr_lett er" value="D" onclick="submit ()"D
    <input type="radio" name="abbr_lett er" value="E" onclick="submit ()"E
    <input type="radio" name="abbr_lett er" value="F" onclick="submit ()"F
    <input type="radio" name="abbr_lett er" value="G" onclick="submit ()"G
    <input type="radio" name="abbr_lett er" value="H" onclick="submit ()"H
    <input type="radio" name="abbr_lett er" value="I" onclick="submit ()"I
    <input type="radio" name="abbr_lett er" value="J" onclick="submit ()"J
    <input type="radio" name="abbr_lett er" value="K" onclick="submit ()"K
    <input type="radio" name="abbr_lett er" value="L" onclick="submit ()"L
    <input type="radio" name="abbr_lett er" value="M"
    onclick="submit ()"M <br>
    <input type="radio" name="abbr_lett er" value="N" onclick="submit ()"N
    <input type="radio" name="abbr_lett er" value="O" onclick="submit ()"O
    <input type="radio" name="abbr_lett er" value="P" onclick="submit ()"P
    <input type="radio" name="abbr_lett er" value="Q" onclick="submit ()"Q
    <input type="radio" name="abbr_lett er" value="R" onclick="submit ()"R
    <input type="radio" name="abbr_lett er" value="S" onclick="submit ()"S
    <input type="radio" name="abbr_lett er" value="T" onclick="submit ()"T
    <input type="radio" name="abbr_lett er" value="U" onclick="submit ()"U
    <input type="radio" name="abbr_lett er" value="V" onclick="submit ()"V
    <input type="radio" name="abbr_lett er" value="W" onclick="submit ()"W
    <input type="radio" name="abbr_lett er" value="X" onclick="submit ()"X
    <input type="radio" name="abbr_lett er" value="Y" onclick="submit ()"Y
    <input type="radio" name="abbr_lett er" value="Z" onclick="submit ()"Z
    <br>
    </FORM>
    <b><FORM NAME="author" method="POST" action="<?php echo
    $_SERVER['PHP_SELF'];?>"></b>
    <SELECT NAME="author_pk " SIZE="20" COLS="10" onclick="submit ()">

    <?php
    //
    //Check for the first time pass
    if( !isset($_POST['abbr_letter']) ) {
    $_POST['abbr_letter'] = $_SESSION['abbr_letter'];
    }
    //
    //If already set then reset the local Var to the Session
    $_SESSION['abbr_letter'] = $_POST['abbr_letter'];
    //
    //Setup for the database call for authors by first letter
    $sqlcmd = $author_detail_ select_by_Lette r . $_POST['abbr_letter']
    . $author_detail_ orderBy;

    --
    Thanks in Advance... http://ichbin.9999mb.com
    IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
    _______________ _______________ _______________ _______________ __________
    'If there is one, Knowledge is the "Fountain of Youth"'
    -William E. Taylor, Regular Guy (1952-)
  • Andy Hassall

    #2
    Re: Common session_start() error..

    On Sun, 05 Nov 2006 23:17:19 -0500, IchBin <weconsul@ptd.n etwrote:
    >I am getting the error message below when ever I try to start my script
    >on two different servers. I am not getting any errors off of my PC. I
    >have looked around and found the answer a simple one. I can not stop the
    >error in my script. The session_start() is the first thing that happens
    >before any Headers are created. Any one have any suggestions. Include
    >the start of the code that uses the session var.
    >
    >Warning: session_start() : Cannot send session cookie - headers already
    >sent by (output started at
    >/home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php:1) in
    >/home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php on line 8
    >
    >Warning: session_start() : Cannot send session cache limiter - headers
    >already sent (output started at
    >/home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php:1) in
    >/home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php on line 8
    >
    <?php
    Do you really have this indentation in the script before the <?php tag? If so,
    that's where the output is coming from - and that's also backed up by the error
    saying the output started on line 1.

    It's possible to mask these problems by turning on one of the variants of
    output_bufferin g, but it's best practice to eliminate the output before any
    headers are sent so it works with or without buffering. This may explain why
    you see it on one setup but not the other - you probably have buffering (or
    zlib output compression) turned on.

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • IchBin

      #3
      Re: Common session_start() error..

      Andy Hassall wrote:
      On Sun, 05 Nov 2006 23:17:19 -0500, IchBin <weconsul@ptd.n etwrote:
      >
      >I am getting the error message below when ever I try to start my script
      >on two different servers. I am not getting any errors off of my PC. I
      >have looked around and found the answer a simple one. I can not stop the
      >error in my script. The session_start() is the first thing that happens
      >before any Headers are created. Any one have any suggestions. Include
      >the start of the code that uses the session var.
      >>
      >Warning: session_start() : Cannot send session cookie - headers already
      >sent by (output started at
      >/home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php:1) in
      >/home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php on line 8
      >>
      >Warning: session_start() : Cannot send session cache limiter - headers
      >already sent (output started at
      >/home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php:1) in
      >/home/www/ichbinquotation s.awardspace.co m/quotes/quotes.php on line 8
      >>
      > <?php
      >
      Do you really have this indentation in the script before the <?php tag? If so,
      that's where the output is coming from - and that's also backed up by the error
      saying the output started on line 1.
      >
      It's possible to mask these problems by turning on one of the variants of
      output_bufferin g, but it's best practice to eliminate the output before any
      headers are sent so it works with or without buffering. This may explain why
      you see it on one setup but not the other - you probably have buffering (or
      zlib output compression) turned on.
      >
      Thanks Andy that was the problem. Sorry, I am new to PHP and I do not
      understand why those four spaces would give me a problem. The "output of
      what" is coming from where? It looks like I do have zlib output
      compression ala phpinfo().

      --
      Thanks in Advance... http://ichbin.9999mb.com
      IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
      _______________ _______________ _______________ _______________ __________
      'If there is one, Knowledge is the "Fountain of Youth"'
      -William E. Taylor, Regular Guy (1952-)

      Comment

      Working...