PHP Session error- real weirdo!!!!

Programming for Search Engines 101. An area for avid PHP and .NET developers to chat about Programming techniques and how to make better use of search engines.

Moderator: Moderators

PHP Session error- real weirdo!!!!

Postby tvjames » Wed Nov 25, 2009 7:00 am

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
tvjames
 

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

Postby latha » Wed Nov 25, 2009 7:46 am

Hey Tom,

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

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

Postby tvjames » Wed Nov 25, 2009 9:30 pm

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..
tvjames
 

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

Postby jay » Wed Nov 25, 2009 9:56 pm

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.
Last edited by jay on Wed Nov 25, 2009 10:07 pm, edited 1 time in total.
Jay M
Write Less, Do More
jay
 
Posts: 475
Joined: Wed Nov 22, 2006 12:05 am
Location: Cochin, India.

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

Postby jay » Wed Nov 25, 2009 10:06 pm

Thomas please try this - Just open notepad and saved same file using ANSI encoding, and it should fix the issue.

Jay M
Write Less, Do More
jay
 
Posts: 475
Joined: Wed Nov 22, 2006 12:05 am
Location: Cochin, India.

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

Postby silvester » Wed Nov 25, 2009 11:00 pm

silvester
 
Posts: 89
Joined: Mon Nov 10, 2008 12:59 am


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests