an extra newline character is being inserted before page prefix and before the doctype
There should never be any whitespace characters allowed before the prefix or doctype tag. those are inserted as plaintext into the page -- and confuses php how to handle session code.