Page 1 of 1

Error initializing session and registering session variables

Posted: Mon Aug 19, 2002 8:39 am
by hounkanrinjp
Hi, The problem is very simple. First let me show you the code:

Code: Select all

$verified_user = $varname;
	session_start();
	session_register("$verified_user");
	print "Welcome dear <u>$verified_user</u>. You will be automatically redirected to the main page in a few seconds.";
	print "<meta http-equiv="refresh" content="0;URL=_overview.php">";
now, when the user logs in, it works fine, but the session can't start and the variable can't be registered. Here is exactly the kind of error I get:


Warning: Cannot send session cache limiter - headers already sent (output started at c:\cms\_verify.php:14) in c:\cms\_verify.php on line 35


Does anyone here knows what's wrong and why i get such and error?
Is is a problem of server configuration or PHP configuration or anything like that? I would really appreciate it if i could get an answer as quicly as possible. Thank you gentlemen! :wink:

Posted: Mon Aug 19, 2002 9:09 am
by Johnm
What does line 14 of c:\cms\_verify.php look like or is that what you have posted. Show us everything through line 14?

Direwolf

Posted: Mon Aug 19, 2002 9:16 am
by llimllib
Yeah, you can't do session_start() after you've output HTML already, because PHP needs to send a cookie with the session_id in it. Probably, you've got some HTML being output on line 14.

Posted: Mon Aug 19, 2002 1:01 pm
by hounkanrinjp
Hi, in fact, I've been wandering on PHPBuilder and I found a topic with the same question and the told the guy not to output any HTML before beginning the session. Tanx guys.