I have the classical Symphony flash message implementation:
$_SESSION['flash'] = "This is a flash message";
header('location: index.php');
It works fine on two different servers but has a strange behavior on a third one, a hosted server, LAMP stack, of which configuration I’m not aware about in detail.
On the third server the script execution brings up first a warning – that the headers have already been sent … (but I didn’t output anything, on the other servers it works) – then if I trigger again the redirecting event, a hyperlink, it brings me into the index.php file with the message rendered. I know how to make it “portable”, by using JavaScript to redirect, but I wonder what is the cause of this behavior. I suspect a server configuration for a PHP or Apache module.
Thanks for your hand!
Javascript is not the portable solution,
but the least portable solution.
The unknown output could be caused by some white-spaces like BOM.
Or you can take a look on headers_sent