Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default PHP "function.session-start" error.

    Error: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/kolzy/public_html/xx/index.php:7) in /home/kolzy/public_html/xx/config.php on line 15

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/kolzy/public_html/xx/index.php:7) in /home/kolzy/public_html/xx/config.php on line 15

    i
    ndex.php
    PHP Code:
    <?php 

    require_once("config.php");
        
        if(
    $logged['in'] === 0){
            
    ?>HTML<?php 
    }
    else{
        
    ?>HTML<?php ?>
    config.php - line 15
    PHP Code:
    session_start(); 
    +rep

  2. #2
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    The session_start(); needs to be before ANY HTML has been echoed onto the page.

    Move it up to line 1.

  3. #3
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Jake, if you mean move it to line 1 in the index.php file then gb2/php.net/ .

    I am *pretty* sure whitespace isn't counted as "HTML" after the php tag.

    --

    If you mean the config.php, thats fine ^_^

  4. #4
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    I mean in the config file .

  5. #5
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Just making sure n_n

  6. #6
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    That's okey dear

  7. #7
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    So just under the <body> tag?

  8. #8
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    session_start(); has to be before ANY html.

    So no, it needs to be at the very top of the page.

  9. #9
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Just move it to the top of the config.php file - first line. There is your answer.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  10. #10
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    You all sort of got the idea, fixed it though. +rep to all. (need to spread Simon)

Page 1 of 2 12 LastLast

Posting Permissions

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