php issue on my website.

Discussion in 'General Off-Topic Chat' started by Aijelsop, Aug 16, 2011.

  1. Aijelsop
    OP

    Aijelsop Question Asker

    Newcomer
    1,000
    7
    Sep 11, 2010
    United States
    I'm not experienced in php at all. Something's messed up here, but I can't find what.

    Here:
    CODE
    Welcome back !

    My Profile | Logout

    Welcome Guest!

    Login | Register


    This is what shows up on my site:
    Code:
    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/LOLNO/public_html/index.php:49) in /home/LOLNO/public_html/index.php on line 52
    
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/LOLNO/public_html/index.php:49) in /home/LOLNO/public_html/index.php on line 52
    Welcome Guest!
    Login | Register
    Help would be MUCH appreciated.
     
  2. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    17,411
    7,992
    Oct 27, 2002
    France
    Engine room, learning
    session_start(); should be at the top of your page, before the first written character on your html generated webpage.

    even space or newline will give an error.
    If your page is in UTF-8, use without BOM.
     
  3. Aijelsop
    OP

    Aijelsop Question Asker

    Newcomer
    1,000
    7
    Sep 11, 2010
    United States
    What is BOM? It is in UTF-8, I entered it, but it just showed up at the top of the page.
     
  4. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    17,411
    7,992
    Oct 27, 2002
    France
    Engine room, learning
    There are two way to identify a UTF-8 document.
    Either using a header (a specific 3 or 4 bytes called BOM (Byte_order_mark) before the first character written in the file), or without that header.
    This BOM is not require in UTF-8 as the byte order to write the characters are the same as the ANSI files, so it can be omitted.

    If the header is not present, the UTF-8 is recognized by checking how the letters are coded inside the document. all special letters (like accents éàç etc.) are coded on 2 bytes instead of 1.

    The problem here is that this header is read and interpreted before the first written character by PHP.


    Your text editor program should have something like Convert/save to :
    UTF-8 without BOM
    ANSI as UTF-8
    It could be something else, like "no header" etc.
     
  5. Aijelsop
    OP

    Aijelsop Question Asker

    Newcomer
    1,000
    7
    Sep 11, 2010
    United States
    [​IMG]

    I'll look through the list

    Can't find those, ugh.
     
  6. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    17,411
    7,992
    Oct 27, 2002
    France
    Engine room, learning
    That's strange.
    What program is it?
    Try searching on google "name of your prog UTF-8 BOM"

    It should have both available, especially if it's a web oriented program.
    If not, I would recommend you try another text editor (Notepad++ is very good).
     
  7. Aijelsop
    OP

    Aijelsop Question Asker

    Newcomer
    1,000
    7
    Sep 11, 2010
    United States
    I am using the x10hosting online HTML edit thing. It uses cPanel Accelerated 2.
     
  8. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    17,411
    7,992
    Oct 27, 2002
    France
    Engine room, learning
    I didn't find anything useful regarding that online editor and the BOM problem.
    And it's designed to be a webpage editor!

    I think you could send a message to the website manager. There should be a way to save without the BOM, or else it's really an unuseful web page editor [​IMG]

    Edit:
    Also, do you have a way to download the files to your computer to really check if the BOM is present?
    Maybe they are always saving without the BOM and the error is caused by something else.

    Your configuration.php doesn't output a text? or doesn't have a space before the first
     
  9. Aijelsop
    OP

    Aijelsop Question Asker

    Newcomer
    1,000
    7
    Sep 11, 2010
    United States
    Yeah, I just downloaded it.
     
  10. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    17,411
    7,992
    Oct 27, 2002
    France
    Engine room, learning
    if you have notepadd++, it will tell you if it's UTF-8 or Ansi as UTF-8, you can convert it easily in the encoding menu.
    If you have a hexeditor, check the first bytes.
    If it starts with "ef bb bf" it's the BOM. delete it and put it back to your website.
     
  11. Aijelsop
    OP

    Aijelsop Question Asker

    Newcomer
    1,000
    7
    Sep 11, 2010
    United States
    Hmmm, it's encoded in ANSI, so I converted it to utf-8 Without BOM and re-uploaded it but nothing happened [​IMG]
     
  12. Issac

    Issac oh!

    Global Moderator
    GBAtemp Patron
    Issac is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    5,055
    1,834
    Apr 10, 2004
    Sweden
     
  13. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    17,411
    7,992
    Oct 27, 2002
    France
    Engine room, learning
    So, you really have a space or a newline, or a header info somewhere in your code.
    Check all included files, like your configuration.php

    You have to delete all space outside the php tags before calling the session_start().
    OR, you could place the session_start(); in your configuration.php [​IMG]

    Could you paste the content of the files ? (or make a zip of it, so I can check. I'm faithful (damn, I have a bad english) trustworthy about your confidentiality, don't worry [​IMG]).


    Edit :
    Oh, I just thought !
    The website is a free hoster?
    Often, free host providers are generating headers themselves to place advertisings !
     
  14. Aijelsop
    OP

    Aijelsop Question Asker

    Newcomer
    1,000
    7
    Sep 11, 2010
    United States
    Gahh, I gotta go. Hopefully these are sucessful when I try them later.

    Thanks for your help. [​IMG]

    Yes, but it is ad free.
     
  15. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    17,411
    7,992
    Oct 27, 2002
    France
    Engine room, learning
    check your error :
    (output started at /home/LOLNO/public_html/index.php:49) in /home/LOLNO/public_html/index.php on line 52
    check both line 49 and 52 of index.php, it should hint you where the problem is located.

    Good luck.
     
  16. Linkiboy

    Linkiboy GBAtemp Testing Area

    Member
    4,888
    37
    May 14, 2006
    United States
    Additionally check out stackoverflow.com, it's a community made to answer your programming questions
     
  17. Aijelsop
    OP

    Aijelsop Question Asker

    Newcomer
    1,000
    7
    Sep 11, 2010
    United States
    It's all fixed. Thanks for all your help.