-1

I'm getting this error:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home2/alson/public_html/iFix/users/tech/pending.php:2) in /home2/alson/public_html/iFix/users/tech/nav.php on line 3

And this is the code for that part:

<?php   
    ob_start();
    session_start();
    $_SESSION['username'];
    $_SESSION['type'];
         if(!isset($_SESSION['type'])){
             header ("location: ../components/login.php");
         }
?>

I think I have tried everything. I've put ob_start and ob_flush at the start and the end of file, made sure session_start is always on top, checked the file encoding if it's not utf-8 with bom but the problem still persists. If I remove the session_start(), the errors disappears but messes up the fetching of data. What can I do about this?

Shehary
  • 9,926
  • 10
  • 42
  • 71
Benedict Payot
  • 421
  • 1
  • 4
  • 14

1 Answers1

0

try to change,

<?php   
ob_start();
session_start();

to

<?php   
session_start();
ob_start();