Jump to content

no session_start()


caster001

Recommended Posts

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;

<?php

session_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 9

Warning: 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 9


Yet, 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

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

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

Create a new file with
[code]<?php
session_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

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

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

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.