"Warning session_start" and "cannot modify header" errors

Permalink
I get these messages when I open a website that I just uploaded, they appear on the top of the page and the content of the page is broken below them.

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Users\goyatravel\goyatravel.com\wwwroot\config\site.php:1) in C:\Users\goyatravel\goyatravel.com\wwwroot\concrete\startup\session.php on line 18
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Users\goyatravel\goyatravel.com\wwwroot\config\site.php:1) in C:\Users\goyatravel\goyatravel.com\wwwroot\concrete\startup\session.php on line 18
Warning: Cannot modify header information - headers already sent by (output started at C:\Users\goyatravel\goyatravel.com\wwwroot\config\site.php:1) in C:\Users\goyatravel\goyatravel.com\wwwroot\concrete\libraries\view.php on line 758


I already tried uploading the latest c5 version to the updates folder and the warnings were gone, but for some reason they are showing up again.

Any ideas to what may be causing them?

Thanks

Fulbright
 
jbx replied on at Permalink Reply
jbx
Check your site.php file. Usually what happens is you have the closing php tag at the bottom ?> followed by some whitespace (carriage return or spaces or tabs or something). This is the same as sending headers back to the browser and php will then fail to start a session and various other tasks.

Easiest way to fix this is to delete the closing php tag. that will ensure the script never drops out of php and into html. The Zend coding standards actually requires that any pure php file does not include a closing php tag for just this reason.

Hope that helps!

Jon
Fulbright replied on at Permalink Reply
Fulbright
Thanks for your reply, however, this does not seem to be the problem in my case. There is no closing tag or any space before or after the text in the site.php file.
jbx replied on at Permalink Reply
jbx
Ahh, sorry, re-read the error and it refers to line 1 of site.php. Is there a space before the opening tag? Failing that, it could be a character encoding issue. Could you send me a copy of your site.php file? Feel free to email it if you don't wanna post it on the forum: jon@jbxonline.net

Jon
Fulbright replied on at Permalink Reply 1 Attachment
Fulbright
There you go, I have attached the file.
jbx replied on at Permalink Best Answer Reply 1 Attachment
jbx
It was a character encoding issue. When I opened it in my editor, there was a wierd couple of characters at the start of the file before the open php tag.

I've uploaded what is hopefully a clean version.

What editor are you using and what operating system?

Jon
Fulbright replied on at Permalink Reply
Fulbright
I usually use dreamweaver, but I think that I edited this file trough the editor on the sites control panel. I'm using windows 7.

May I ask what editor did you use in order to see the weird characters?

Thank you so much for this, the errors are gone now. :D
jbx replied on at Permalink Reply
jbx
I use Netbeans.

However, if you edited it using the servers built in editor, then will be the issue. Chances are, you are using a different character encoding to the servers editor and that has screwed it up.

Glad it sorted it :)

Jon