parkej60 Posted May 7, 2010 Share Posted May 7, 2010 <?php header('Location: http://www.google.com/'); ?> The above code consistently gives me a headers already sent error. The above code is the only piece of code on the page there is absolutely no other code/html on the page it's simply that one line. I read the initial post in the forum, but I really feel like whitespace can't be the issue? Could my text-editor (Text Wrangler) be adding something? Does anyone have any suggestions? Any help would be appreciated because I feel like I'm going insane. I've used this plenty of times before and had no problems. Quote Link to comment https://forums.phpfreaks.com/topic/201029--/ Share on other sites More sharing options...
doddsey_65 Posted May 7, 2010 Share Posted May 7, 2010 try adding ob_start(); at the very top of your page and ob_flush(); at the end. Quote Link to comment https://forums.phpfreaks.com/topic/201029--/#findComment-1054705 Share on other sites More sharing options...
kenrbnsn Posted May 7, 2010 Share Posted May 7, 2010 Make sure the text editor is saving the file as plain ASCII text, not UTF-8 formated. Ken Quote Link to comment https://forums.phpfreaks.com/topic/201029--/#findComment-1054706 Share on other sites More sharing options...
parkej60 Posted May 7, 2010 Author Share Posted May 7, 2010 ob_start(); header('Location: http://www.google.com/'); ob_flush(); Gives me the same error. Will try doing this in Aptana to see if that address the ASCII issue. Quote Link to comment https://forums.phpfreaks.com/topic/201029--/#findComment-1054709 Share on other sites More sharing options...
parkej60 Posted May 7, 2010 Author Share Posted May 7, 2010 So this is the code that I've entered into Aptana saved as index.php and uploaded to the site. <?php header('Location: http://www.google.com/'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <p>Test</p> </body> </html> This is what I get showing up in my error_log. PHP Warning: Cannot modify header information - headers already sent by (output started at /mnt/target03/364491/www.dcd-support.com/web/content/sandbox/index.php:1) in /mnt/target03/364491/www.dcd-support.com/web/content/sandbox/index.php on line 1 The only thing that shows up on the page is the "Test" copy. Quote Link to comment https://forums.phpfreaks.com/topic/201029--/#findComment-1054712 Share on other sites More sharing options...
parkej60 Posted May 7, 2010 Author Share Posted May 7, 2010 Ok so the saga has ended. Ken was correct. What I needed to do was change the text format in Text Wrangler from UTF-8, to UTF-8, no BOM. Not till I uploaded this onto my development server did I see these awkward marks . Did a quick google search and it mentioned something about BOM. Apparently something changed in my Text Wrangler because this has never been an issue before1 Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/201029--/#findComment-1054727 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.