Wallpapers Forums Login

Warning: Session_start() [function.session-start]: Cannot Send Session

Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.

The other day i kept getting this error:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/a-header.php:10) in /var/www/header.php on line 26


so to fix it I moved the session_start() function from line 26 to line 1 on my header.php file.

That fixed it.

I am posting here just incase anyone else is getting it..

If you have benefited from this post, wallpaperama would appreciate a link back to wallpaperama.com - Thanks


Description
bool session_start ( void )

session_start() creates a session or resumes the current one based on the current session id that's being passed via a request, such as GET, POST, or a cookie.

If you want to use a named session, you must call session_name() before calling session_start().

session_start() will register internal output handler for URL rewriting when trans-sid is enabled. If a user uses ob_gzhandler or like with ob_start(), the order of output handler is important for proper output. For example, user must register ob_gzhandler before session start.

Notes
Note: If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.


so what does this all mean really.

ok, i will try to explain more simple.

lets say i have a script that looks like this:

<?php
echo 'hello wallpaperama';
session_start();
?>
Ally Fri May 18, 2012
<? session_start() so helpful to me,thanks a lot.
sam Wed Apr 18, 2012
nice .........thanks
fuzzyhead Tue Apr 03, 2012
Thanks a lot you're the best.
abeera Wed Mar 28, 2012
I was facing the same issue at jobs111 dot com and at ysapak dot com
But after shifting session_start() at line1 the issue was resolved. Thanks a lot
Salma Mon Mar 12, 2012
I am facing these errors :(


Warning: session_start() [function.sessi Cannot send session cookie - headers already sent by (output started at /home/eitlabs1/ in /home/eitlabs1/ on line 423

Warning: session_start() [function.sessi Cannot send session cache limiter - headers already sent (output started at /home/eitlabs1/ in /home/eitlabs1/ on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/eitlabs1/ in
gigi Tue Feb 07, 2012
it was really helpful.
shishir Tue Jan 31, 2012
Hello , i am facing a problem with joomla

Warning: session_start() [function.sessi Cannot send session cookie - headers already sent by (output started at /home/alalamia/ in /home/alalamia/ on line 370

Warning: session_start() [function.sessi Cannot send session cache limiter - headers already sent (output started at /home/alalamia/ in /home/alalamia/ on line 370

Warning: Cannot modify header information - headers already sent by (output started at /home/alalamia/ in /home/alalamia/ on line 372
varsha Wed Jan 11, 2012
thanx, this solution helped me...
ARUN Wed Jan 04, 2012
HELPED ME A LOT
vivek Thu Nov 10, 2011
Thanks bro.......
tariqul Thu Nov 03, 2011
dear I use session start() ,then it shows the following warning massage
session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at H:\xampp\htdocs\login_suc in H:\xampp\htdocs\login_suc on line 4
what can I do now?
anant Wed Aug 24, 2011
Thanks it helped me too..
THIS Sun Aug 14, 2011
in order to protect this kind of agly error you have to put the php session_start() function in head of ur code.....
<? session_start();?>
<html> rest of ur php and html code goes in here
.
</html
2pac Sat Aug 13, 2011
helped a ltot
walkrie Fri Aug 05, 2011
Little info you've put here has absolutely saved my life, thank you so much

Related Content

Information

Share

wallpaperama | Wallpapers | Forums | Terms Of Service

copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5