Warning: session_start() [function.session-start]: Cannot send session

RegisterLogin
Warning: session_start() [function.session-start]: Cannot send session
Post Description: Warning: session_start() [function.session-start]: Cannot send session
Tags: Warning:, session_start(), [function.session-start]:, Cannot, send, session
This Post Was Posted On Feb 29, 2008 By web hosting #1177
The other day i kept getting this error:


     Code:
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 2 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
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
rancid
#1613 1
thanks...phew that worked for me...thanks again
Feb 24, 2008 Reply Report abuse
hostman
#1612 2

if that's the case, then you need to check any of your includes, check for any blanks or white spaces on line one of any of the files, if you are getting this errors, its because you are sending some information to the browser before the sessionstart function. you just have to check and doublecheck, eventually, you will find it. it happened to me, i went crazy trying to find it, but eventually, i found it. just remember, you can't have anything before sessionstart



you can also get more help at:



http://www.php.net/manual/en/function.session-start.php



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.




as you can see, even the official php site says you must call session_start() before anything you send to the browser, that includes white spaces. white spaces are hard to find, because you can't see them, you have to look for them
Feb 04, 2008 Reply Report abuse
Logan
#1611 3
this doesn't help me one tiny bit... i'm getting the error being reported on line 1 - all that's on that line is a session starter...
Feb 04, 2008 Reply Report abuse
suma
#1610 4
thanks you helped me a lot .i could rectify the errors.,and finally it working good.
i removed the extra "session start();" from the page and removed the extra header lines from the page expire .php,so it woring fine.
Jan 30, 2008 Reply Report abuse
anggi
#1609 5
angie is the coolers
Dec 31, 2007 Reply Report abuse
Adriani
#1608 6
who help me about this error
warning: session_start() [function.session-start]: open(/var/tmp/sess_519142a978e7bec6c052145fa892aca3, o_rdwr) failed: permission denied (13) in /mnt/web1/22/58/51474058/htdocs/kd/korenicajomla/joomla_1.0.13-stable-full_package/includes/joomla.php on line 800

warning: session_start() [function.session-start]: cannot send session cookie - headers already sent by (output started at /mnt/web1/22/58/51474058/htdocs/kd/korenicajomla/joomla_1.0.13-stable-full_package/includes/joomla.php:800) in /mnt/web1/22/58/51474058/htdocs/kd/korenicajomla/joomla_1.0.13-stable-full_package/includes/joomla.php on line 800

warning: session_start() [function.session-start]: cannot send session cache limiter - headers already sent (output started at /mnt/web1/22/58/51474058/htdocs/kd/korenicajomla/joomla_1.0.13-stable-full_package/includes/joomla.php:800) in /mnt/web1/22/58/51474058/htdocs/kd/korenicajomla/joomla_1.0.13-stable-full_package/includes/joomla.php on line 800
this error i have in administration panel
Dec 30, 2007 Reply Report abuse
ranjani
#1607 7
thanks a lot.. it really helped me..
Dec 20, 2007 Reply Report abuse
gipss
#1606 8
still having it... though i tried every solution in this topic


warning: session_start() [function.session-start]: cannot send session cache limiter - headers already sent (output started at /home/admin/public_html/zaid/htpre/userclass.php:62) in /home/admin/public_html/zaid/htpre/sessiondata.php on line 28

this is the sessiondata.php and the error in

if ($sid == "") {
session_start();
$sid = session_id();
} else {
session_start($sid);
}
Dec 07, 2007 Reply Report abuse
SIMILAR ERROR
#1605 9
i was able to fix the error on the cookies when placing them on the first lines. however, i have a similar error with header("location:mypage.php"); the error displayed is

warning: cannot modify header information - headers already sent by (output started at /home/mydomain/public_html/mypage_add.php:4) in /home/mydomain/public_html/mypage_add.php on line 72.

the following are the codes:

71: if ($resultpage){
72: header("location:detail.php?name_id=$name_id#p$page_id");
73: exit();
74: }else{

what seems to be the problem?
Dec 03, 2007 Reply Report abuse
Rajasekhar and anil
#1604 10
thanks very much . i got the solution of my error. it's very useful to the new learners. thanks a lot.............
Nov 27, 2007 Reply Report abuse
sri
#1603 11
thankyou, it helped.
Nov 26, 2007 Reply Report abuse
amit
#1602 12
error: [2] unpack() [function.unpack]: type n: not enough input, need 4, have 0 | line: 3099 | file: /home/allkindt/public_html/shared/code/tcpdf.php
tcpdf error: some data has already been output, can't send pdf file
Nov 25, 2007 Reply Report abuse
amit sinha
#1601 13
error: [2] unpack() [function.unpack]: type n: not enough input, need 4, have 0 | line: 3099 | file: /home/allkindt/public_html/shared/code/tcpdf.php
error: [2] cannot modify header information - headers already sent by (output started at /home/allkindt/public_html/shared/config/tce_db_config.php:180) | line: 2409 | file: /home/allkindt/public_html/shared/code/tcpdf.php
tcpdf error: some data has already been output to browser, can't send pdf file
i face this problems to create pdf file
Nov 19, 2007 Reply Report abuse
amit
#1600 14
error: [2] session_start() [function.session-start]: cannot send session cookie - headers already sent by (output started at /home/allkindt/public_html/shared/config/tce_db_config.php:180) | line: 190 | file: /home/allkindt/public_html/shared/code/tce_functions_session.php
error: [2] session_start() [function.session-start]: cannot send session cache limiter - headers already sent (output started at /home/allkindt/public_html/shared/config/tce_db_config.php:180) | line: 190 | file: /home/allkindt/public_html/shared/code/tce_functions_session.php
error: [2] cannot modify header information - headers already sent by (output started at /home/allkindt/public_html/shared/config/tce_db_config.php:180) | line: 191 | file: /home/allkindt/public_html/shared/code/tce_functions_session.php

hi i face this problems..please give me a better solution....thanks..byeee
Nov 19, 2007 Reply Report abuse
Maciej
#1599 15
guys, thanks a lot for explaining the issue with utf encoding with bom. i had same problem like the fellow below me but managed to solve it. all i needed to do was to change conding to utf8 without bom in notepad++
Sep 09, 2007 Reply Report abuse
View More Comments
Leave Your Comments...
©2011 Webune Forums - Wed Dec 21, 2011 5:27 pm
Powered by: Webune Forums V3