PDA

View Full Version : Error: "Headers already sent..."



PowellElite.com
12-13-2007, 10:08 AM
I've searched the forums looking for the answer to my problem, I've found other solutions but they do not work for me.

My Coding Error:

Warning: Cannot modify header information - headers already sent by (output started at /home/powellel/public_html/myiphonetheme.com/google.php:1) in /home/powellel/public_html/myiphonetheme.com/google.php on line 1


Exact Code:
<?php header('Location:http://www.google.com');?>


I created this page just for this error testing purpose. There are NO white spaces before or after (<?php ..... ?>)

Does anyone know what is wrong?

Thank You for you help!
:)

PowellElite.com
12-13-2007, 11:24 AM
I just spoke to HostMonster Support.

As they pointed out to me the PHP script file says using their online file manager.

PHP Script Code:

<?php header('Location:http://www.google.com');?>

Some how these Odd Characters "" got appended onto the header of the file during FTP. I use FileZilla for all my uploads.

Has anyone else happen to have this occur to them? Support said they never seen it before.

Thanks

shadmego
12-13-2007, 12:43 PM
What are you using to create the page? Notepad?

PowellElite.com
12-13-2007, 03:00 PM
I'm using Microsoft Expression Web.

Its odd though the characters are not being placed on all the uploaded pages...


Viewing the Page in raw form it still does not show the characters until uploaded to Hostmonster. :confused:

shadmego
12-13-2007, 03:09 PM
Have you tried creating a similar page in a simple text editor, like notepad? I'm not familiar with Expression Web so I can't say if that behavior is known.

I also have Dreamweaver so I can't help test it out for you either.

~regards

PowellElite.com
12-13-2007, 03:27 PM
Guess What!

I thought I all ready tested through simple notepad, I did but I made the mistake opening it through Microsoft Web Expression after wards and saving it.

When saving through Microsoft Web Expression it creates some bogus header that is not visible even viewing through notepad in-which is transfered to hostmonster.

Verified by only using notepad and then uploading vs. using Microsoft Web Expression.

linFox
12-13-2007, 10:26 PM
This happens to someone I know (and host pages for), so I've seen it quite a lot. I'm not sure exactly why it is created or what is is (it may be some malformed byte order mark that isn't being recognised, that's my only real theory).
I'm fairly sure he uses Web Expressions too (or Sharepoint, the other Microsoft web design program) so it's probably a Microsoft bug.

PowellElite.com
12-13-2007, 10:38 PM
BOM or Byte Order Mark
In theory a Byte Order mark or BOM is a useful thing to have on a UTF-8 encoded web page. The problem is that some web browsers and any PHP page will display either three rectangular boxes or the characters " " In the final version you can remove the BOM from your CSS files by removing the checkmark from the encoding dialog box but this is not an option for your web pages.

http://by-expression.com/web-designer/rtm-review/image/encoding.jpg

Thanks to: http://by-expression.com/web-designer/rtm-review/

--- FINAL SOLUTION ---

Add the following code to the top of your PHP Files... It tricks the EW, but doesn't effect your code!!

<?php /* REMOVES "" FROM HEADER IN Microsoft Expression Web ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<?php */ ?>


Thanks to: http://www.expression-web-designer-help.com/forum/forum_posts.asp?TID=532

--- Last Thought ---

The last Solution works a little bit until you run into a PHP call like header('Location:'); Eyes Rolling...

READ THIS:
The MS support guy I just spoke to said
quote:
No, it doesn't support PHP you should learn ASP instead.

My reply is unprintable. He's probably now applying an ice pack to his ear.

Hot DesignZ
12-14-2007, 01:04 AM
BOM or Byte Order Mark
In theory a Byte Order mark or BOM is a useful thing to have on a UTF-8 encoded web page. The problem is that some web browsers and any PHP page will display either three rectangular boxes or the characters " " In the final version you can remove the BOM from your CSS files by removing the checkmark from the encoding dialog box but this is not an option for your web pages.

http://by-expression.com/web-designer/rtm-review/image/encoding.jpg

Thanks to: http://by-expression.com/web-designer/rtm-review/

--- FINAL SOLUTION ---

Add the following code to the top of your PHP Files... It tricks the EW, but doesn't effect your code!!

<?php /* REMOVES "" FROM HEADER IN Microsoft Expression Web ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<?php */ ?>


Thanks to: http://www.expression-web-designer-help.com/forum/forum_posts.asp?TID=532

--- Last Thought ---

The last Solution works a little bit until you run into a PHP call like header('Location:'); Eyes Rolling...

READ THIS:
The MS support guy I just spoke to said
quote:
No, it doesn't support PHP you should learn ASP instead.

My reply is unprintable. He's probably now applying an ice pack to his ear.

Thats Microsoft for you. I would not ever think of touching anything that has to do with the internet and is made by MS

screw IE
screw Expressions/Front Page
screw MS Server
screw ASP
screw MSQL


They should worry about fixing Vista.

Don't get me wrong I love Windows anything else by them I think is garbage

Sorry had to rant

:)