Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Posts
    362

    Unanswered: php session_start problem

    I have IIs in win XP professional and php 5.
    I use the session_start() statement but there is the warning can not send session cookie,headers already sent by (...line 1) line 1.
    I have no blank lines, what is wrong?
    As I see the problem is here when I save the page as utf-8, when I change the save enconding the warnings are not here.
    I want to use utf8 characters related also with utf8 at mysql, if I will save the php as unicode and not utf-8 all will be ok?
    Dimis

  2. #2
    Join Date
    Jan 2005
    Posts
    362
    The answer I found is to save as UTF-8 encoding without a BOM.Any other solution is welcome.

  3. #3
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    BOM? Is that an acronym for something?
    So far as I have seen in a few years, the only reason for a "warning can not send session cookie, headers already sent" is because some output is being performed. This can be an echo, but ALSO can be caused by spaces/blank lines at the top/bottom of scripts. Some editors will do this automatically which is a problem obviously so I expect this is where the error is actually occuring. It shouldn't be related to your character encoding.

  4. #4
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    BOM = Byte Order Mark.

    It is a string of characters (three I think) at the start of a file saved using UTF-8 encoding. When the file (html or php) is output from a web server, these characters are content sent to the browser. Since they are part of the file before any <?php tag, the result in a header already sent message referring to line 1, but there is no traditional white-space before the <?php tag.

    Pages using UTF-8 character encoding don't need them, so they are just an editor/file thing (your better programming editors have an option to save without the BOM.)

    This is a fairly common problem (MS Notepad typically saves a file that has any special characters in it as UTF-8 instead of ANSI/ASCII.)

Posting Permissions

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