caster001 Posted November 22, 2006 Share Posted November 22, 2006 Hi everyone,This is my last hope, because no one seems to know the answer to my problem.The start of my page is this; <?phpsession_cache_limiter('private');$cache_limiter = session_cache_limiter();session_cache_expire(30);$cache_expire = session_cache_expire();session_start();?><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Language" content="en-au"><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Client Login</title>followed by the rest of the page, then on top of the page when it runs is;Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/********/public_html/login.php:1) in /home/********/public_html/login.php on line 9Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/********/public_html/login.php:1) in /home/********/public_html/login.php on line 9Yet, I can still write session data and read it..etc. And I get a warning still if I even try to kill the session...so I don't know.If ANYONE can help me, it would be a godsend.Thank you. Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 22, 2006 Share Posted November 22, 2006 What's on line 9 of the file login.php?Ken Link to comment Share on other sites More sharing options...
caster001 Posted November 22, 2006 Author Share Posted November 22, 2006 the line 9 or what ever line is always where the session_start() command is.By the way, is this just a 'header' problem..as stated as one of the pinned topics in the forum?Should I just not bother putting the session_start() above all the HTML and just put it after the<head> starts in the page? Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 22, 2006 Share Posted November 22, 2006 My mistake. The error message actually is saying that the output was started in line 1. Make sure that the start of the PHP "<?php" is at the very start of the file and there is nothing before it.Ken Link to comment Share on other sites More sharing options...
caster001 Posted November 22, 2006 Author Share Posted November 22, 2006 actually..scratch that, putting it after the <head> didn't do squat.and yeah, it's at the very beginning, nothing before it. Link to comment Share on other sites More sharing options...
caster001 Posted November 22, 2006 Author Share Posted November 22, 2006 ugh...should I be talking to my host about this?I mean, when has anyone had a problem with session_start()...I mean, the session is there..I can write and read from it...I just..can't start or kill it apparently.*sigh* Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 22, 2006 Share Posted November 22, 2006 I would suggest deleting the line containing "<?php" and retyping it. Sometimes a nonprinting character gets inserted before the start tag and will produce this result.Ken Link to comment Share on other sites More sharing options...
caster001 Posted November 22, 2006 Author Share Posted November 22, 2006 I was really hoping that would fix it...but I retyped it, put session_start() right below the <?php, and still the same thing, except now it's just saying line 2, where the command is...what I can't figure out...how can anything be outputted when...there's no code before <?php ??? Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 22, 2006 Share Posted November 22, 2006 Create a new file with[code]<?phpsession_start();?>[/code]If this doesn't get an error, start adding lines form the old file to this file until you do get an error. If no error occurs, we can conclude that there was something wrong with the original file.Ken Link to comment Share on other sites More sharing options...
wildteen88 Posted November 22, 2006 Share Posted November 22, 2006 Make sure the encoding your saving your php file as is ANSI, most editors should save with ANSI encoding. UTF-8 encoding can cause headers already sent errors. Link to comment Share on other sites More sharing options...
caster001 Posted November 23, 2006 Author Share Posted November 23, 2006 Ok, I tried many suggestions...from people in a few forums...but one person asked me to look in the php.ini file...I did...what happens if session_start isn't listed in the directive?Because I'm still getting the same thing.(btw..thanks to kenrbnsn and wildteen88 for helping me out with this) Link to comment Share on other sites More sharing options...
caster001 Posted November 23, 2006 Author Share Posted November 23, 2006 ok NEW info!I contacted my hosting, they said, to their knowledge, the session starts automatically, reiterating the session_start() command would cause the header errors, HOWEVER! If I don't start the session by command I can write and read session written variables..but, I can't get a session id, if I start the session, even WITH the header errors, I can get the session id and I can successfully unset and destroy the session...All I can say..is WHY me?(update: I'm sorting this out with my host, thanks for everyones time on this :) ) Link to comment Share on other sites More sharing options...
Recommended Posts