Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Apr 2007
    Posts
    144
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Cannot modify header

    I have a page I'm calling headers on. I'm getting the error
    PHP Warning: Cannot modify header information - headers already sent by
    So i use headers_sent() to see where the issue is. It says line 1. At line 1 I only have a <?php on the line with NO white space before it. more test.. same error. I then remove everything and only have one line of code with a header(Location:http://www.blabla.com) on line 1. Again no white space before or after PHP. Still the same error.

    Why is this happening? Why are my headers failing? Thanks much.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Its possible your host prepends a file to the page. Can you give us a link? Perhaps tell us the EXACT error rather than just a snippet of it?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    If you're using UTF-8 encoding make sure you aren't saving the file with a BOM header.

  • #4
    Regular Coder
    Join Date
    Apr 2007
    Posts
    144
    Thanks
    5
    Thanked 0 Times in 0 Posts
    i have thought that the host has something going on behind the scenes.

    The files are behind a secure network.

  • #5
    Regular Coder
    Join Date
    Apr 2007
    Posts
    144
    Thanks
    5
    Thanked 0 Times in 0 Posts
    dont even know what BOM header are.... researching.... nope i dont think im using them.

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You can't really see the BOM header. Make sure when uploading the file you are using ascii and not binary.

    http://www.xs4all.nl/~mechiel/projects/bomstrip/
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    Regular Coder
    Join Date
    Apr 2007
    Posts
    144
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Found the problem. Thanks to all those that helped.

    Basically there was some type of invisible character in the beginning of my file. I copied all of the file but the first and last character, then pasted into a new doc. Saved over the old doc and it works!

    I'm using EditPlus3 text editor in case anyone knows why this invisible char was added.

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    That invisible character was the BOM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •