session variables error message

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

juansoul
New php-forum User
New php-forum User
Posts: 29
Joined: Tue Oct 08, 2002 6:33 pm

session variables error message

Postby juansoul » Tue Dec 03, 2002 12:02 pm

can anyone tell me why i am getting this error this message when I try to start a session?

Code: Select all

Warning: Cannot send session cookie - headers already sent by (output started at /home/www/bullzeyecreative/CHN/cart.php:86) in /home/www/bullzeyecreative/CHN/cart.php on line 105
[/code]

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Wed Dec 04, 2002 12:20 am

You are alredy answered at your question =)


Cannot send session cookie - headers already sent by (bla-bla-bla)


Let me guese - are your script looked like this

Code: Select all

<html>
</html>
<?php
//some code
?>

wiredme
New php-forum User
New php-forum User
Posts: 7
Joined: Sun Dec 08, 2002 9:02 pm

Re: session variables error message

Postby wiredme » Sun Dec 08, 2002 9:13 pm

juansoul wrote:can anyone tell me why i am getting this error this message when I try to start a session?

Code: Select all

Warning: Cannot send session cookie - headers already sent by (output started at /home/www/bullzeyecreative/CHN/cart.php:86) in /home/www/bullzeyecreative/CHN/cart.php on line 105
[/code]



try this :
<?
#session_start(); if you r using sessions
ob_start();
header ("Pragma: no-cache");

/code here


ob_end_flush();
?>
it occurs because your script is attempting to print something on screen. To avoid that you have to save it into buffers before it will be printed in screen..

Hope it works
:lol:


Return to “PHP coding => General”

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 1 guest