Cannot send session cache limiter

Published on and tagged with cakephp  faq  problem

An often asked (PHP) question in the CakePHP IRC channel is how to fix the problem which causes the following warning:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at 
/home/dho/projects/test/trunk/app/controllers/users_controller.php:7) in /home/dho/projects/cake_1.2.x.x/cake/libs/session.php 
on line 131

It is a bit nasty. The warning points us to line 7 (the last line). Hm, but line 7 looks correct, doesn’t it?

    class UsersController extends AppController {
        var $uses = null;
        function edit() {}

Well, if you mark line 7 with your mouse, you see that there is a space after the “>” character. And this space is the cause of the warning. If you remove the space, the warning disappears.

52 comments baked

  • Aaromal


    I am getting this error in one of my pages. I checked for spaces, encoding.Nothing seems to be wrong. I even tried removing the controller and view file for the corresponding page. When I try to view the page now, it complains about the missing controller but the warnings are still there!!!!

    Please note that this page works fine in my local (Windows) environment but having problems when I host it in shared Linux server.

    Any help is much appreciated!!! Struggling with this issue for some time now.

  • cakebaker

    @Aaromal: Hm, and the error only appears on one page, and works fine with other pages?

© daniel hofstetter. Licensed under a Creative Commons License