Jump to content

Session Start - Headers already sent. What am I doing wrong?


Recommended Posts

I expected this. Thanks.
But, nope. There is no other code, no space before the <?php nothing.
What I posted above is exactly what is in the file.

I tried attaching the file. They won't let me.
You could just copy the code and publish it to your server and see what happens.
I'm at a loss.


Link to comment
Share on other sites

Works for me with Apache. There MUST be some white space or an unprintable code that is being output first. Is this being called from another page or called directly with a URL (that is the way I tested it)? Also, what HTTPD server are you using (Apache, IIS)?

Edited by gw1500se
Link to comment
Share on other sites

I don't know what they use so you probably need to contact their tech support. As a test, remove the session start then look at the page source to see if there is anything (including white space) before the text. They may be outputting headers or something ahead of your page.

Link to comment
Share on other sites

requinix you are correct. I'm using Notepad++ and the file is encoded in utf-8.
I have determined that if I encode it in ANSI the problem goes away. If I encode it in utf-8 the problem reoccurs.
I've since learned that to check for BOM look in the lower right hand corner of Notepad++.
It should say utf-8 BOM. It does NOT say that.
It says DOS/Windows utf-8 instead.

So, after reading your post I investigated further.
I found a setting in Notepad++ that allows me to save in utf-8 without BOM.
That solved my problem.




Edited by MAtkins
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.