Possible Duplicate:
Headers already sent by PHP
I'm having a problem with session_start()
and header('Location:')
on a log out php file.
I'm linking to the log out file using a simple anchor tag from a html file. The logout php file is this:
<?php
session_start();
session_destroy();
header("Location: index.php");
?>
To see where the errors where I used,
error_reporting(E_ALL);
ini_set('display_errors', '1');
I got a warning that "Warning: session_start(): Cannot send session cache limiter - headers already sent" on line 4 (where session_start();
is) and Warning: Cannot modify header information - headers already sent on line 6 (where header('Location')
is).
I've had a look around for others who have had similar problems. I've made sure there's no whitespace before the session_start()
. Nothing is being outputted before it. I've tried only setting session_start()
if it's not already set. I've tried buffering it with ob_start()
. I tried a relative and absolute path for the redirect just to make sure. But nothing has worked.
Am I missing something? Any help is much appreciated.