php issue on my website.

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

Aug 16, 2011

php issue on my website. by Aijelsop at 9:35 PM (903 Views / 0 Likes) 16 replies

  1. Aijelsop
    OP

    Newcomer Aijelsop Question Asker

    Joined:
    Sep 11, 2010
    Messages:
    1,000
    Country:
    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

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,407
    Location:
    Engine room, learning
    Country:
    France
    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

    Newcomer Aijelsop Question Asker

    Joined:
    Sep 11, 2010
    Messages:
    1,000
    Country:
    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

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,407
    Location:
    Engine room, learning
    Country:
    France
    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

    Newcomer Aijelsop Question Asker

    Joined:
    Sep 11, 2010
    Messages:
    1,000
    Country:
    United States
    [​IMG]

    I'll look through the list

    Can't find those, ugh.
     
  6. Cyan

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,407
    Location:
    Engine room, learning
    Country:
    France
    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

    Newcomer Aijelsop Question Asker

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

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,407
    Location:
    Engine room, learning
    Country:
    France
    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

    Newcomer Aijelsop Question Asker

    Joined:
    Sep 11, 2010
    Messages:
    1,000
    Country:
    United States
    Yeah, I just downloaded it.
     
  10. Cyan

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,407
    Location:
    Engine room, learning
    Country:
    France
    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

    Newcomer Aijelsop Question Asker

    Joined:
    Sep 11, 2010
    Messages:
    1,000
    Country:
    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

    Member Issac Mini-mod

    Joined:
    Apr 10, 2004
    Messages:
    4,454
    Location:
    Sweden
    Country:
    Sweden
     
  13. Cyan

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,407
    Location:
    Engine room, learning
    Country:
    France
    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

    Newcomer Aijelsop Question Asker

    Joined:
    Sep 11, 2010
    Messages:
    1,000
    Country:
    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

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,407
    Location:
    Engine room, learning
    Country:
    France
    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

    Member Linkiboy GBAtemp Testing Area

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

    Newcomer Aijelsop Question Asker

    Joined:
    Sep 11, 2010
    Messages:
    1,000
    Country:
    United States
    It's all fixed. Thanks for all your help.
     

Share This Page