Error in creating session

Discussion in 'PHP' started by Harish kumara, Jun 1, 2009.

  1. #1
    Hi I'am beginner to php.I got problem in creating session in php file.I am developing my project using codeignitor and extjs as client side.I have created login form it should take the input from user and send it to login.php file in that file am trying to start session.But its giving errror this

    A PHP Error was encountered
    Severity: Warning

    Message: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\php\PEAR\JSON.php:1)

    Filename: controllers/login.php

    Line Number: 15


    I thought that there may be error in session creation but when i used the same code in other file to create session thats working nicely..
    session_start();
    ------------
    ------------
    session_destroy();
    Really I don't know why its giving like that please help me to get out of that error.
    thank you
    regards,
    harry
     
    Harish kumara, Jun 1, 2009 IP
  2. givemeknol

    givemeknol Active Member

    Messages:
    22
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    88
    #2
    session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
    Remove any space before using session functions.
     
    givemeknol, Jun 2, 2009 IP
  3. SHOwnsYou

    SHOwnsYou Peon

    Messages:
    209
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Put session_start() at the very top of the page.

    If you have any output before session_start() it will not work and gives the Headers already sent message.
     
    SHOwnsYou, Jun 2, 2009 IP