conused with Sessions again

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
harsha
Forum Contributor
Posts: 103
Joined: Thu Jul 11, 2002 1:35 am
Location: Bengaluru (Bangalore) > Karnataka > India

conused with Sessions again

Post by harsha »

I removed the blank line in the inlcuded file

"Txt.inc.php"

the syntax is some what looks like this

<?
session_start();

if(!isset($_SESSION['SkinNow'])){
$_SESSION['SkinNow'] = 'Default';
}

after this i am inlcuding all the include files in which i have stored the fucntions
........................
?>

the script working i am able to change the skins for my site, even the sessions are also stored in /Sessions directory. But the below metioned waring is still indicated by the parser.

[Waring]: session_start(): <a href=session-function......</a>cannot sen the cookie info headers already sent on line 2 in index,php

I get two warning which is some similar to above mentioned type, I read the Latest PHP Manual in that it is mentioned that Sending

session.use_only_cookies is set to 0 in php.ini
is this warning coming because of this ????


I am using WinXp, PHP 4.3.4, and Apache 1.37
I test tested the script on php5- Beta 3 I get the Same warning

Please Help me by telling the reason why is that warning coming???
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

It means you have output somewhere before you do session_start().
Output is basically anything that's sent to the browser, such as html and also whitespace.
Check there's no spaces before ..
<?php
session_start();

even...
<space here>
<?php
session_start();
won't work as the space is considered output.
Post Reply