0

I am not sure why, it gave me this error, and my session_start(); is already at the first line. I goole it and get many people facing the problem but answer does not solve my problem. It may have caused Encoding in UTF-8. but i am not sure. Here is my code.

<?php 
session_start();

 if(!isset($_SESSION['designation']))
 {
 header('Location: login.php');
}

?>

Is there any mistake i made?

  • Do you include your script in some other file? Do you have any invisible characters before ` –  May 04 '14 at 10:48
  • there are multiple Q like this in stackoverflow but they are not solved i think. and i think it caused for Encoding in UTF-8 so if it is problem then how to solve it? thanks AD7six – user3495099 May 04 '14 at 10:50
  • Yes i add the same script in other file but i don't think it is problem and there are no any invisible characters before php – user3495099 May 04 '14 at 10:55
  • I tend to have output_buffering set 'on' in the php.ini file. you can check with phpInfo() if it is set. If not, it is worth trying just to see if you have some output elsewhere. – Ryan Vincent May 04 '14 at 11:04
  • @user3495099 there are multiple questions like this that are unsolved - because it's an _incredibly_ common question and people get bored of reiterating the same tired answers =). Please read accepted answer on the duplicate question - your current problem isn't unique. – AD7six May 04 '14 at 11:12
  • and switch to UTF-8 WITHOUT BOM – fdreger May 04 '14 at 13:15

1 Answers1

-1

Seems like you issue is in the other files, in which you are including the script.

The Documentation of session_cache_limiter says:

The cache limiter is reset to the default value stored in session.cache_limiter at request startup time. Thus, you need to call session_cache_limiter() for every request (and before session_start() is called).

You may verify your complete code.

Ankur Thakur
  • 56
  • 10
  • -1 for basically distracting away from the problem. "The problem" is not related to the configured session cache limiter it is **headers already sent** - almost certainly given the rest of the question text because there's UTF8 bom at the start of the file. While I assume you wrote this answer with the intent to help - it doesn't. – AD7six May 04 '14 at 11:45