Session_start

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stever
Forum Newbie
Posts: 2
Joined: Sun Feb 07, 2010 10:36 pm

Session_start

Post 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
limitdesigns
Forum Commoner
Posts: 25
Joined: Sat Feb 06, 2010 9:05 pm

Re: Session_start

Post 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.
Post Reply