I have a page which is a one php page and when there is POST data it calls a function that does a 302 redirect (header sending). Locally it works just fine, but online it gives out a Warning (headers already sent).
The nature of the warning is well understood. What I do not get is how come on my local machine it works fine?
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$url);
exit;
?>
i ran into the same issue a month ago, i was using AppServ to run PHP in windows, everything worked lovely, i uploads me whole site and absolutely nothing worked - i depend on header redirects heavily.
Are you uploading the files via FTP? If so, are you ensuring that you are doing so in ASCII mode? Also make sure your editor is saving files without a BOM - though I am greatly suspecting it is the FTP issue so check that first.
The first rule of Tautology Club is the first rule of Tautology Club.
Hey!
Thanks for a quick reply!
Only redirect is a problem, the rest is very well.
The difference I found is this:
Local: Server API Apache 2.0 Handler
Online: Server API CGI
But online server is using Apache, I checked.
phpinfo give lots of info and some of it is different, some is not. I need to know what to look for. What setting might affect this?
On the other site I am doing it, redirect works fine, but the warning is still there (data will be resent) if I go BACK. Localy it does not happen and whole reason of using such a redirect would be to avoid this situation.
Last edited by Louigi Verona; 09-25-2010 at 07:48 AM.
cgi
Directive Local Value Master Value
cgi.check_shebang_line 1 1
cgi.fix_pathinfo 1 1
cgi.nph 0 0
cgi.rfc2616_headers 0 0
No idea honestly... search for stuff with "header", "redirect", "cgi"?
I found all 3 in mine, then figure out what it means I guess- if it's different anyways.
Well, look. I understand why the warning is issued - indeed, it should. The header is called when some html IS actually output, since that header is INSIDE one function I am using. However, it works fine offline. By the book - it shouldn't. But it does. How come?
Here's how the function looks, it is called after some html had been output.
Bookmarks