Results 1 to 3 of 3

Thread: Already Sent Headers

  1. #1
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Already Sent Headers

    Ok, I know this problem is common. I read explanations EVERYWHERE. I tried using multiple different PHP editors to see if Notepad2 was lying and there was extra characters. But nothing, zip, zilch. Heres my code and the exact error log.

    PHP Code:
    <?php
    session_start
    ();
    $logged=$_SESSION['logged'];
    $menu="<div class=\"linkbox\">
    <a href=\"http://fassist.profusehost.net/\">
    Home
    </a>
    </div>"
    ;

    if (
    $logged=="yes") {
    $menu=$menu.="<div class=\"linkbox\">
    <a href=\"http://fassist.profusehost.net/userinfo\">
    User info
    </a>
    </div>
    <div class=\"linkbox\">
    <a href=\"http://fassist.profusehost.net/logout\">
    Logout
    </a>
    </div>"
    ;
    }

    else {
    $menu=$menu.="<div class=\"linkbox\">
    <a href=\"http://fassist.profusehost.net/login\">
    Login
    </a>
    </div>"
    ;
    }

    print(
    "$menu");
    ?>
    (ignore the no such file or directory errors, I just haven't made a footer.php yet...)
    [22-Feb-2008 20:59:25] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /home/fassist/public_html/index.php:8) in /home/fassist/public_html/php/menu.php on line 2


    [22-Feb-2008 20:59:25] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/fassist/public_html/index.php:8) in /home/fassist/public_html/php/menu.php on line 2


    [22-Feb-2008 20:59:25] PHP Warning: main(php/footer.php) [<a href='function.main'>function.main</a>]: failed to open stream: No such file or directory in /home/fassist/public_html/index.php on line 42


    [22-Feb-2008 20:59:25] PHP Warning: main(php/footer.php) [<a href='function.main'>function.main</a>]: failed to open stream: No such file or directory in /home/fassist/public_html/index.php on line 42


    [22-Feb-2008 20:59:25] PHP Warning: main(php/footer.php) [<a href='function.main'>function.main</a>]: failed to open stream: No such file or directory in /home/fassist/public_html/index.php on line 42


    [22-Feb-2008 20:59:25] PHP Warning: main() [<a href='function.include'>function.include</a>]: Failed opening 'php/footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/lib/php/extensions:/usr/lib/php/extensions/no-debug-non-zts-20020429') in /home/fassist/public_html/index.php on line 42
    EDIT: Also one time I read to use ob_start(); and ob_flush(); which had no effect, I check php.net and it said to use ob_end_clear() or something like that to silently delete it, tried and all it did was make the script not work at all.
    Last edited by TimFA; 02-23-2008 at 05:08 AM.

  2. #2
    Join Date
    Aug 2007
    Location
    Ohio
    Posts
    79
    Thanks
    0
    Thanked 15 Times in 15 Posts

    Default

    Is this menu.php? Can we see index.php? It looks like the output is being sent from index.php, and the code you referenced looks like it's menu.php.

  3. The Following User Says Thank You to jackbenimble4 For This Useful Post:

    TimFA (02-23-2008)

  4. #3
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    DUHUR. It just hit me why, its because I'm including menu.php inside index.php which contains data...I suppose I'll have to reference it at the top, no printing just assign the variable then print within index.php. I think that should work.

    Thanks man,
    Tim

    EDIT: and yes thats menu.php.

Bookmarks

Posting Permissions

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