need help cant login into my site admin panel

Discussion in 'PHP' started by bizpro99, Aug 15, 2006.

  1. #1
    Not sure if this is in the right forum?

    Anyway Im not sure what happened but when I try to login into one of sites I get this error:


    Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/myspace2/public_html/index.php:2) in /home/myspace2/public_html/plugins/admin/admin_entrance.php on line 4

    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/myspace2/public_html/index.php:2) in /home/myspace2/public_html/plugins/admin/admin_entrance.php on line 4

    Warning: Cannot modify header information - headers already sent by (output started at /home/myspace2/public_html/index.php:2) in /home/myspace2/public_html/plugins/admin/admin_entrance.php on line 17


    Any suggestions?
     
    bizpro99, Aug 15, 2006 IP
  2. swirl1980

    swirl1980 Peon

    Messages:
    53
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i'm guessing that u haven't made sure the very first thing is the session start...

    <?
    session_Start();

    ....rest of code....
    ?>

    And if you are using a header file, make sure it comes before the header file.

    <?
    session_start();
    include("header.php");

    ....rest of code....
    ?>

    hope this helps!!!
     
    swirl1980, Aug 16, 2006 IP
  3. raziel

    raziel Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Another thing with this error is avoid calling session_start() after something has been printed. If there is something printed means a header has been sent.
     
    raziel, Aug 18, 2006 IP
  4. LineOfSight

    LineOfSight The Doctor

    Messages:
    125
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Make sure your code appears right at the top of the page - no spaces, make sure it's at line 1
     
    LineOfSight, Aug 18, 2006 IP
  5. surefire

    surefire Guest

    Messages:
    40
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Or, start off your code (very top of the file) with ob_start();

    This starts output buffering and can often reduce these errors. The best recommendation is to follow the previous advice and clean up the code, but I wanted to throw in this little tip. If you use it, it's a best practice to finish up the file with ob_end_flush(); to clear the buffer. For more info on these functions, see php.net
     
    surefire, Aug 18, 2006 IP