-4

I know that this question is very often in this Forum. But I tried everything.

First: I have the following error:

PHP Warning: session_start(): Cannot send session cookie - headers already sent by

session_start(): Cannot send session cache limiter - headers already sent

Cannot modify header information - headers already sent by

The whole time this code worked but suddenly ig get this error.

I have no Output or space or empty row before I start the session.

I also delete my whole Webspace and copied it again. And also I have the same Problem.

This is frustrating because it worked a Long time and now nothing works anymore.

Pls help

Community
  • 1
  • 1
urgame
  • 1
  • 2

2 Answers2

0

First check If header sent or not if sent then load your page through js or else send your header. See below example

if (headers_sent()) {
    echo '<script>window.location ='. your loaction .'</script>';
    die();       
}
else {
    header('location: your location');
    die();
}
0

Did you try with ob_start() at the beginning of you code

You should use ob_start() at the beginning of every script that uses !

<?php 
  ob_start();
  // start your code here
?> 
Devdutt Sharma
  • 391
  • 1
  • 2
  • 10