-2

Possible Duplicate:
Headers already sent by PHP

I know there are some posts about this but none of them really helped me, I get the error below and in the index.php file I only have one line php code and it still throws this error. What can I do to fix this???

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

<?PHP setcookie("cookname", "", 1); ?>
Community
  • 1
  • 1
Hector Lamar
  • 239
  • 2
  • 11

2 Answers2

1

There is a space/any other visible or visible character(s) before <?php in your code.

Raab
  • 34,778
  • 4
  • 50
  • 65
  • Look below you were right as well but as I could not see the character I couldn't remove it so recreating the file helped me. – Hector Lamar Aug 10 '12 at 10:04
0

The most common problem is space character before starting PHP tag <?php. Other cause can be UTF-8 BOM starting character or other invisible character. Inspect your script with some HEX editor and check does it start with 3F 3C. If you have anything before those two hex string, delete it. You can use other editors and turn on option to show "invisible characters".

mikikg
  • 1,488
  • 1
  • 11
  • 23
  • That is it, I didn't check with HEX editor as I don't have it installed but as there was no space visible to my eyes I just created new file and copied the code over and it works now so there must have been this BOM invisible character as you say. It is fine now and works well, thank you very much – Hector Lamar Aug 10 '12 at 10:05