Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nothing sent to browser, yet session problems

Status
Not open for further replies.
Jul 28, 2005
358
FR
OK, I know that if you send something to the browser and then try to session_start() you get errors about the headers already being sent.

However, I have a file which is accessed from a meta refresh after a login. The first lines in the file are
Code:
<?
session_start();

but I am still getting the errors. Nothing is output to the screen before the session_start at all once the file is called by the meta refresh. If I go to the next page which also uses sessions (this is a client area where they need to follow various steps) the problem disappears so sessions can obviously be set.

The funny thing is on my local apache server (xampp on winxp pro) I don't get this; It's just on my host (linux).

Any ideas.

Richard
 
Well, I sorted it by adding ob_start(); before the session is started. What I don't understand is why I got the message in the first place when the file was called by the meta refresh and the session was the first thing on it.

ALso why do I not get this on my local xampp installation, just when I upload it?

Richard
 
Absolutely positive. The code I posted earlier is what i at the top of my file with no blank lines at all.
 
I would examine the file on a byte-by-byte level and verify what is there. I've seen file transfers go awry in lots of ways.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Thanks,

It seems fine with teh ob_start() before the session_start() so I'll probably leave it there for now.

I will be interested to find out why it happens though. It always seems to be after a meta refresh takes me to the page so that must have something to do with it.


Richard
 
ob_start is just occluding the issue although it removes the symptoms.

what is the precise error you get? usually php reports the line on which the headers have already been sent from.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top