Re: Cannot send session cookie
| From: | Andre Dubuc | Date: | Mon, 12 Jul 2004 15:14:50 +0000 |
| Subject: | Re: Cannot send session cookie | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190242@lists.php.net to get a copy of this message | ||
Hi Michael,
session_start(); must be the very first line of code on the page, with no
whitespaces trailing, else you'll get the 'header already sent' message:
<?php session_start(); ?>
Hth,
Andre
On Monday 12 July 2004 10:40 am, Michael Purdy wrote:
> Folks
>
> I am a new to php. I am currently learning about session handling and
> would appreciate some assistance with the following:
>
> I am using php 4.3.7 and I am using the default values in the php.ini for
>
> session.use_cookies = 1
> session.cache_limiter = nocache
>
> When experimenting with a few simple lines of code
>
> <script language='php'> ---- This is line 14
> session_start();
> </script>
>
> I get the following errors:
>
> Warning: session_start(): Cannot send session cookie - headers already sent
> by (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15
>
> Warning: session_start(): Cannot send session cache limiter - headers
> already sent (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php
> on line 15
>
> Can anyone offer me a insight on the reason for the error.
>
> Mike