Re: session_start() and header
| From: | php3 at developersdesk dot com | Date: | Wed, 21 Jun 2000 10:32:07 +0000 |
| Subject: | Re: session_start() and header | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2467@lists.php.net to get a copy of this message | ||
Addressed to: sarahana <sarahana@cyberjunkie.com>
php-general@lists.php.net
** Reply to note from sarahana <sarahana@cyberjunkie.com> Wed, 21 Jun 2000 00:25:06 -0700
>
> Hi, I was just wondering: How come when I use session_start(); the
> error is
>
> Warning: Cannot add header information - headers already sent in
> C:\HTTPD\HTDOCS\admin.php
Sessoin_start() tries to set a cookie. Cookies must be sent in the
header portion of the transmission. If you send ANYTHING, even a
single space before the <? at the top of your file, it is too late to
start the session.
Session_start() needs to happen very early in your program, before
ANYTHING is sent to the browser. You might get away with some
header() and setcookie() calls of your own, but no content.
Rick Widmer
Internet Marketing Specialists
www.developersdesk.com