Error message session_start() [function.session-start]: Cannot send session

by phu
9 replies
hello,

Can someone suggest why I get this eror message on my webpage at the top. Below is error message. I would appreciate how to tale action on removing the error.


Warning
: session_start() [ function.session-start ]: Cannot send session cache limiter - headers already sent (output started at /home/gizmo168/public_html/example.com/testimonials.php:2) in /home/gizmo18/public_html/example.com/testimonials.php on line 3

I tried everything to resolve but I cant get rid of the error.

Thank You
#error #functionsessionstart #message #send #session #sessionstart
  • Profile picture of the author CarloD.
    your script is trying to do something after the headers have been sent... this needs to be done before they are sent.... that what the error means.

    what is this script for? what does it do?
    Signature

    {{ DiscussionBoard.errors[2627914].message }}
  • Profile picture of the author gfsocial
    This is a common error... you likely have code or a white space before the session start command..

    The RULE is you cannot have anything before the session_start(); NOT ONE CHARACTER, otherwise, the browser thinks the webpage has already started, so before you start session_start(); YOU CANNOT START THE HEADER. You start the header with any character, this includes white spaces (space bar)....

    it current is on line 3 i think it says above.. move it to the VERY start of line one..
    {{ DiscussionBoard.errors[2628253].message }}
  • Profile picture of the author phu
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <?php
    session_start();
    ob_start();
    ?><HTML><HEAD><TITLE></TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK
    href="comments/css/stylesheet.css" type=text/css rel=stylesheet>
    <META content="MSHTML 6.00.6000.17080" name=GENERATOR></HEAD>
    <BODY oncontextmenu="return false;"

    I have removed this line here but it still shows the same error message on browser. This line still shows up when i got to source code on the browser.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    {{ DiscussionBoard.errors[2628465].message }}
  • Profile picture of the author BillLudwig
    Move

    <?php
    session_start();
    ob_start();
    ?>

    to the top of the page. It needs to be before any output or any HTML.
    {{ DiscussionBoard.errors[2628529].message }}
  • Profile picture of the author phu
    i have move this right to the top. and the error still shows.

    <?php
    session_start();
    ob_start();
    ?><HTML><HEAD><TITLE></TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK
    href="comments/css/stylesheet.css" type=text/css rel=stylesheet>
    <META content="MSHTML 6.00.6000.17080" name=GENERATOR></HEAD>

    Has it got to do with my website builder treillian. when i remove the top line here -

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    this line, it goes back to where it was at the top when i go to source code from browser.
    {{ DiscussionBoard.errors[2628621].message }}
    • Profile picture of the author gfsocial
      Originally Posted by phu View Post

      Has it got to do with my website builder treillian. when i remove the top line here -
      yup... thats likely what is going on.. you need to edit this manually if need be.. use note pad?
      {{ DiscussionBoard.errors[2628972].message }}
      • Profile picture of the author phu
        ah yes, i just fixed it. I use notepad++ to encode it to utf 8 without bom. then save as and ftp.

        error script gone. what a whole day spent on trying to get rid of this error.

        thanks anyway. hope this thread helps!
        {{ DiscussionBoard.errors[2628983].message }}
  • Profile picture of the author dealbert.net
    Use this at the beginning of your script.

    if(!session_id()){ session_start();}
    {{ DiscussionBoard.errors[2629089].message }}

Trending Topics