Solved – Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent


Hello Friends, This is the most common error, you will face when you will start working with sessions in PHP. I got below error. "Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent" and i got success to solve this. So i would like to share this with all of you.

There are many ways,this error originates. Below are some cases which may solve above error for you.

Look at below links for solutions.

Solution 1: Write ob_start() before session_start() statement. As ob_start() turn on output buffering means no output sent to script and it stores the output in internal buffer.
Solution 2: If solution one does not work for you than please make sure that nothing gets sent to the browser before session_start() statement. This happens in case there is a white space or some charactors before session_start() or even before <?php tag. If this is the case, please remove spaces or charactors.It will sovle the "Cannot send session cache limiter" problem.
Solution 3: If both solutions does not make any difference and still you have the same problem than try to set the encoding from UTF-8. UTF-8 encoding add some characters before <?php tag which is the same case as solution 2 and you have remove those charactors. But as those charactors automatically output in page, you can solve this by using UTF-8 encoding WITHOUT BOM (Byte Order Mark). "Don't save your UTF-8 files with BOM as it creates issues".

To know more about programming,MYSQL database,php info,php editor,programming php,Open-source,php help and php script , subscribe to our feed by entering email address below. You will get updates via email about every tutorial posted on this site . It will not take more than a sec.

Enter your email address:
Feel free to ask any question. Just leave your comment below and we will answer your comment with in 24 hours.

About Rakshit Patel
I am PHP Freelancer, Rakshit Patel AKA WordPress Freelancer working as PHP Programmer India. I am here to share all my developing knowledge, quick coding techniques, quick solutions to save your time and help you guys for any issue or bug fixing. If you have any PHP, WordPress, Magento related work, please contact me. I am interested for the work.

45 Comments on Solved – Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent

  • Jerwin
    August 18, 2010 at 8:00 am

    thank you very much… very useful

  • Jerwin
    August 18, 2010 at 1:30 pm

    thank you very much… very useful

  • Pooja
    September 18, 2010 at 6:19 pm

    thanks buddy, great done! :)

  • Karen
    October 27, 2010 at 2:52 am

    None of the above helped me :( but thank you for sharing!

  • Luke Bream
    October 28, 2010 at 10:15 pm

    Hi RakshitI would really appreciate some help….I’m having exactlty this problem and wondered if you could take a look at it for me. Any advice would be really appreciated. Its a “caspio” embeded datapage using wordpress. Their support says they cannot find a bug. They have tested exactly the same installation setup on their own server and it works fine without the error.I have hit a complete brick wall in terms of sorting the problem and could really use some help.Thanks Luke

  • Jasminemohammad
    January 21, 2011 at 12:38 pm

    ya your solution is working

    thank you very much

  • Stephen
    January 25, 2011 at 8:25 am

    I still get this error
    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent

    I have tried all the suggested things and it still doesn’t fix the problem.

    I have this at the start of the page

    please help if anyone has some other ideas, i'm going mad trying to solve this


  • Nimesh Parekh
    February 2, 2011 at 4:22 pm

    Help me to solve this error.
    No one Solution is work for me … :(
    Please help me

  • Venki
    March 24, 2011 at 2:21 pm

    help me this much of warning Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent.

  • Venki
    March 24, 2011 at 2:48 pm

    hai this is venki am got solution this problem,

    don’t put free face before
    to create begineing the page

  • Venki
    March 24, 2011 at 3:18 pm

    hai this is venki ,
    u put the beginig

  • Benj
    March 26, 2011 at 12:06 pm

    You saved my life! I hope I will be able to write an article as helpful as your in the future!

  • Prabudha Kushagra
    April 13, 2011 at 7:10 am

    thanks buddy…. it helped me a lot

  • Trivikram
    June 17, 2011 at 12:20 pm

    Thankyou. But Warning Messages are also printed to the file. What I how can I remove them.

  • shubh
    June 25, 2011 at 2:21 pm

    good one it help me to solve my problem

  • krishna kumar
    July 8, 2011 at 5:59 pm

    thanks man

  • ryan
    July 16, 2011 at 3:02 pm

    mate you are like my new best friend
    this problems has been p*****g me off for soo long and you just solved it for me
    cheerse pal

  • Android Fanatic
    July 21, 2011 at 7:36 pm

    Hi! thanks for this article. It helped a lot (My problem is solved with solution #3).

    Is there an explanation to why is this happening?

  • Moutushi
    August 19, 2011 at 12:50 pm

    Thanks for your solution. Its works for me.

  • Sean Korich
    September 3, 2011 at 3:48 pm

    Hello, i am having this same issue, and I am ready to pull my hair out trying to figure it out. None of the solutions worked for me. My pages are encoded with utf-8 without the BOM, yet I am still getting this error.


    //Include database connection details
    //Array to store validation errors
    $errmsg_arr = array();

    //Validation error flag
    $errflag = false;

    If you cvould please give me some tips as to why this is till hapening, I would be forever grateful. Thanks in advance.

  • Rakshit Patel
    September 3, 2011 at 3:55 pm

    Please make sure that there is no space before start of page().

  • Sean Korich
    September 3, 2011 at 4:17 pm

    there is no white space at the beginning of my page, the session_start; is on line 2 of the php file with no white space before it. There are no HTML tags before it either. I should also say that this works on other pages on the site as all the pages are coded the same way. It just does not make nay sense to me. Any ideas? Thanks

  • Shaikh Mahbubur Rahaman
    September 14, 2011 at 11:08 pm

    ini_set (‘session.use_cookies’, 1000);
    $_SESSION[‘session_name’] = “superadmin”;
    $_SESSION[‘userid’] =”0″;

    but still that error

  • Haroon Khattak
    September 27, 2011 at 11:19 am

    Thanks bud.. Worked like a charm for me.. :-)

  • ram
    November 9, 2011 at 12:42 pm

    yep..very useful.thanks.I am using soft and get this problem.solution 2 solved my problem.

  • dev team
    November 12, 2011 at 10:51 am

    thanks so much, silly error

  • Chris Mervyn
    December 1, 2011 at 3:09 am

    The space before <?php caused the problem… thanx man

  • Atechie
    January 9, 2012 at 11:48 am

    thanx alot…the first solution worked like a charm….

  • viresh
    January 21, 2012 at 11:12 pm

    thanks for the post its very helpful. It solved my error.

  • Navneet
    March 27, 2012 at 2:18 pm

    Thanks dude ! it really works after edit from Ultra Edit software.

  • varsha
    April 12, 2012 at 6:15 pm

    Just donwload notepad++ and select
    encoding -> encode with utf-8 without BOM and save the php file.

    it works

  • Atal123
    June 24, 2012 at 4:50 am

    thank you so much for the explanation.

    option 2 worked for me very well.
    i placed the session tag above the .

    and it worked 😉

  • K6t
    July 5, 2012 at 4:31 pm

    Thanks you!!! its helps me..

  • Benjamin Kiene
    August 19, 2012 at 9:20 pm

    Hello, I have another (4th) way, to solve the problem wich should be mentioned in the article above or for anybody who reads this…

    I found out, that having the php code in an windows formated textfile (with .php ending) running on a linux server causes this problem with this “Warning: … Cannot send session cache limiter – headers already sent” message as well. As soon as I converted this file to a unix styled textfile the warning messages disapeared!

    You can’t believe how happy I am, after years and years of showing this error?!!

    Thank god, for having a solution now!

    All the best for you!

    Greetz, Benjamin

  • mayank
    September 1, 2012 at 12:09 am

    thank you it is very helpful for me.

  • Chandan
    June 2, 2014 at 5:48 pm

    Thanks all of you for help me…

  • wein
    September 25, 2014 at 5:46 pm

    it doesn’t work :(
    any other magic out there????

  • Wam Caro
    February 28, 2015 at 10:44 am

    Encoding in UTF without BOM did the trick for me… THANKS!!!!

  • bhawana
    March 4, 2015 at 3:00 pm

    second method is very good…this is benificial for us….thank you very much…

  • yezad
    March 5, 2015 at 6:17 pm

    you are a life saver. thanks man :)

Leave a Reply

Your email address will not be published. Required fields are marked *




DHgate Computers - Computers, Cell Phones & more
  • We find everbuying built in php and use css to control the style.

About Author

PHP Freelancer

PHP Freelancer I am PHP Freelancer, Rakshit Patel working as PHP Programmer India. I am here to share all my developing knowledge with you people. For Hire PHP Developer India, contact me.
Follow on twitter: @raxit4u2

Get Free Programming Tutorials:

Become a Fan

Popular Topics

Recent Posts

Most Popular

Recent Comments

Get a Free Quote
Security Question: 3 + 8 = ?
Listing all pages