1
votes

I knew that this question may mark as duplicate but I can't find my answer from any duplicated post so I decided to post it in my own.

I have a Pages with a session. after all task, there is a button that link into this controller called Profileresult.php but even I do not have a code yet its surprising me that I got this error.

here is the error.

A PHP Error was encountered

Severity: Warning

Message: session_start(): Cannot send session cache limiter - headers already sent (output started at /home3/oep2732/public_html/knowyourscore/application/controllers/Profileresult.php:1)

Filename: Session/Session.php

Line Number: 140

Backtrace:

File: /home3/oep2732/public_html/knowyourscore/index.php Line: 315 Function: require_once

I created a controller called Profileresult.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Profileresult extends CI_Controller {


    public function index()
    {
    }

}

?>
1
make sure you have not an empty space before the start of php tag or just put ob_start() in beginning of php codeAman Maurya

1 Answers

7
votes

Check your controller file. Remove any empty space within that file. For example:

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Profileresult extends CI_Controller {
    public function index() {
         //your codes here
    }
}
?>

In your IDE, if you don't have any comment on top of <?php tag, make sure it is in line 1. No empty spaces. Same goes to at the end of ?> tag. If you have empty spaces after that. Those errors will occurs. I've encounter the same problem as yours. I tried to check my controller file as Aman Maurya said, and yes I have few lines of empty spaces. Removed that, that error not display anymore.