TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   session Problem (http://www.talkphp.com/general/2587-session-problem.html)

Rendair 04-05-2008 07:25 PM

session Problem
 
Can anyone tell me what this means? lol its really annoying me

PHP Code:

Warning:  session_start() [function.session-start]: Cannot send session cookie headers already sent by 


crazyryan 04-05-2008 07:43 PM

Do you have session_start() at the top of your page before anything else?

Wildhoney 04-05-2008 08:53 PM

As Ryan alluded to, it's just another case of text being outputted -- even a blank space, before the cookie function is called.

Rendair 04-05-2008 08:54 PM

Yes i do have it right at the start

mortisimus 04-06-2008 10:05 AM

If it still doesn't work then just make sure that the session is being started before ANY html output.

Take a look at PHP: session_start - Manual?

sketchMedia 04-06-2008 02:16 PM

or you could use ob_start() ?

PHP Code:


echo 'wadwadwa';

session_start();

$_SESSION['ls'] = 'dawdwa'

produces the error because the text has been sent to the client, so use output buffering to pipe all the text/cookies/session cookies all at once

PHP Code:

ob_start();
echo 
'wadwadwa';

session_start();

$_SESSION['ls'] = 'dawdwa';
ob_flush(); 

it could also be being caused by whitespace before the <?php.


All times are GMT. The time now is 10:14 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0