http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/ Regards, Igor Escobar Systems Analyst & Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 3:59 PM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx>wrote: > On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: > > I am trying to set a cookie and a session, but seem to be running into a > > wall. > > > > I have tried different variations, and keep getting the same error > message > > > > If I have this > > > > <?php > > > > session_start(); > > > > I get this: > > Warning: session_start() [function.session-start]: Cannot send session > > cookie - headers already sent by (output started at > > C:\xampp\htdocs\weiss\assessresult.inc.php:2) in > > C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 > > > > Warning: session_start() [function.session-start]: Cannot send session > cache > > limiter - headers already sent (output started at > > C:\xampp\htdocs\weiss\assessresult.inc.php:2) in > > C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 > > > > If I have this: > > session_start(); > > > > setcookie('sale_cookie','$sale_value', time()-3600); > > setcookie('assess_cookie','$assess_value', time()-3600); > > I get this > > > > > > Warning: session_start() [function.session-start]: Cannot send session > > cookie - headers already sent by (output started at > > C:\xampp\htdocs\weiss\assessresult.inc.php:2) in > > C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 > > > > Warning: session_start() [function.session-start]: Cannot send session > cache > > limiter - headers already sent (output started at > > C:\xampp\htdocs\weiss\assessresult.inc.php:2) in > > C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 > > > > Warning: Cannot modify header information - headers already sent by > (output > > started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in > > C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 > > > > Warning: Cannot modify header information - headers already sent by > (output > > started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in > > C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 > > > > If I delete and start over, I stll get the "headers already sent"... I > have > > tried numerous other variations, but all with the same error. > > > > What am I missing here? > > > > Thanks > > > > Gary > > > > > > > I would have thought it was obvious, the file assessresult.inc.php is > being called before your session_start(). Have you put your code before > every include? > > > Ash > www.ashleysheridan.co.uk > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >