Page 1 of 1

Session_start

Posted: Sun Feb 07, 2010 10:43 pm
by stever
I am new to using PHP, I developed a web site on my home computer and then wished to put on to the webb.
On my home pc using windows, apache, mysql and php the web site worked well.

After putting up on to the hosting service i have encountered the following

When using
session_start();
check_valid_user();

I get the folowing error messages.

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /****/****/***/output_fns.php) in /****/****/***/add_new_project_form.php on line 3

Can any one help as to the cause, if take out then the user is shown as not logged in when moves to another page.

Regards

Re: Session_start

Posted: Sun Feb 07, 2010 11:55 pm
by limitdesigns
Sessions can only be initiated before any output is sent. This includes <head> and <body> tags. Make sure you don't have anything echoing, or anything being output, before you call session_start(). I usually just put it at the very top of the page to be sure.