0

I have included Session_start() and ob_start(); in my login page and still getting error Warning:

session_start(): Cannot send session cache limiter - headers already sent (output started at ) on line 3.

I don't know what is the problem.

I tried placing ob_start on first line and on second line same with the Session_start.

Here is my code:

 <?php
session_start();
ob_start();

error_reporting(0);

if(!empty($_SESSION["admin_prince"])){
    header("location:../index.php"); 
}
include '../connection.php';

 ?>
Prince Arora
  • 354
  • 1
  • 6
  • 20

3 Answers3

4

I don't know, if your code is well formatted in your question. But if so, remove the blank space before <?php.

trpx
  • 168
  • 7
0

Try this

<?php session_start(); ?> 
<?php
ob_start();

error_reporting(0);

if(!empty($_SESSION["admin_prince"])){
    header("location:../index.php"); 
}
include '../connection.php';

 ?>
0
        <?php
if(session_id() == '') {
    session_start();
}
ob_start();

error_reporting(0);

if(!empty($_SESSION["admin_prince"])){
    header("location:../index.php"); 
}
include '../connection.php';

 ?>

try this.

Ruchi
  • 17
  • 6