SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry session_start error?

    Hi All

    Please help, I always get the error when I start my page with this function. Can somebody help me to understand it please.
    Here is the error:
    ----------------------------

    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Webroot\examples\user-authentication\basic\login.php:1) in C:\Webroot\examples\user-authentication\basic\login.php on line 3


    -------------------------------------------

    thank you
    S

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't start sessions after output has been started. Put session_start() at the very top of your script.

  3. #3
    SitePoint Member HaloprO's Avatar
    Join Date
    Dec 2005
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can also delay the output until the entire script has finished running, For this you would use output buffering:
    PHP Code:

        ob_start
    ();
        echo 
    'sup';
        
    session_start();
        
    $_SESSION['cool'] = 'I am cool';
        echo 
    ", $_SESSION[cool]";
        
    ob_flush(); 


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
  •