Please help with error: Warning: session_start() [function.session-start]:

by 13 replies
17
Hi All,

I have a html web template which I have put my php code at top of it and when I upload the file then I am getting Warning: session_session_start() as below and have no clue how to get ride of it.
I have other templates with no problem att all but this one.I have googled and gone through some tips to find out but no success.(like free space before&after PHP open/close tag).

can someone please take look at the below code and tell me what is wrong with it.
Please ,I am not good at coding and all those staff...much appreciated if you guide me easy undrestanding.

Many Thanks
#programming #error #functionsessionstart #sessionstart #warning
  • Just sent you a PM - read it ASAP
    • [ 2 ] Thanks
  • I sent this to you as a PM - but in case anyone finds this thread with the same issue.

    This is most often caused by a stray space, new line.. or anything at all before the first <?php on your page.

    The reason for this is that, PHP sends response headers as soon as the first response body byte is output. This include anything prior to your opening PHP tag. If later on, your code attempts to send a header (eg. by doing a redirect, http authentication, server error... anything really). You will get this error.

    Cheers,
    Michael
    • [ 2 ] Thanks
  • Thanks Michael,
    As I sent PM you ,I have copied and paste the same code into different pages with out any issues but this file only.
    and I do not find any spaces before/after <?p or ?> in the file.
  • Hi ferenan,

    Are you certain? the error is actually quite specific - /home/mb/public_html/mysitlink.com/index.php:1 refers to line 1 of index.php.

    Is there a blank link?

    Cheers,
    Michael
    • [1] reply
    • yeah it is interesting.
      I have not created the codes by myself though ,it was a ready template but opened it with dreamweaver and put the php into it.
      I even opened it with text editor maruo and re-saved it as unicode utf-8 but no success as you can see the attach photo.
  • Michael ,
    No blank line ....it is only the below code in line 1 at top of the file.

    <?php

    Thanks
  • Interesting - OK, next option.. which editor did you use to create/edit the file? Some editors will add a unicode BOM to the beginning of the file if saved as unicode.

    Cheers,
    Michael
  • For some reason when I try to open that image I get an error from WF - so unfortunately I can't see it...

    Can you try saving as ASCII? UTF-8 can contain a BOM.
    • [ 1 ] Thanks
    • [2] replies
    • The output buffer is being written too before session_start() has been called.

      Usually a error, I suspect in connect.php
      • [ 1 ] Thanks
      • [1] reply
    • Yeah....Thanks alot...I opened it in the text editor and checked the format section in preferences then it was a check mark selected for BOM as you said but did not notice it before.and that solved the issue.

      again Thanks .
  • If you use something like Dreamweaver, it'll add invisible characters as emptee said. Try using notepad, removing the first few lines and typing them out fully. You'll probably find that the issue disappears.
    • [ 1 ] Thanks
  • I had the same problem once. Glad to see that Emptee helped you. Great response!

Next Topics on Trending Feed