Page 1 of 1

PHP Session error- real weirdo!!!!

PostPosted: Wed Nov 25, 2009 7:00 am
by tvjames
Hi there

Thought would share this issue just incase anyone knows about it.

Off late, we get this very unsuall error while using sessions in our code.

The minute we give the statement session_start() in our code, it throws the famous session header error pointing out that content has already been placed on to the page.

To make it worse, this error comes even if wejust have one single line in our code; i.e.session_start() statement.

Apart from The One above and the apache server, who really does know why this happens, if anyone else has any idea on this issue please do share your experince here.

Regards

Re: PHP Session error- real weirdo!!!!

PostPosted: Wed Nov 25, 2009 7:46 am
by latha
Hey Tom,

What's the exact error. Do we have any whitespaces, tabs before the session_start() ?

Re: PHP Session error- real weirdo!!!!

PostPosted: Wed Nov 25, 2009 9:30 pm
by tvjames
None what so ever Latha.

really frustrating error and waste of time actually.

So far how we get rid of this error is we create a new page and then paste the code which is there in the error page and run it again. and thsi time trust me it runs without any error..

Re: PHP Session error- real weirdo!!!!

PostPosted: Wed Nov 25, 2009 9:56 pm
by jay
Thomas, as you mentioned it's a weird issue which is difficult to find out.

The error happens because either blank space or html output happened before session start.

But if you use CUTE FTP you can edit online files and there you can see a blank line / space appears just above the PHP open tag <?php

Unable to find any other solution which you've mentioned and the one above.

Re: PHP Session error- real weirdo!!!!

PostPosted: Wed Nov 25, 2009 10:06 pm
by jay
Thomas please try this - Just open notepad and saved same file using ANSI encoding, and it should fix the issue.


Re: PHP Session error- real weirdo!!!!

PostPosted: Wed Nov 25, 2009 11:00 pm
by silvester