Page 1 of 2

session start

Posted: Fri Oct 26, 2007 9:14 am
by FireElement
:cry: I keep getting the following errors :(


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at localhost/homepage/index.php:2) in localhost/links.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at localhost/homepage/index.php:2) in localhost/links.php on line 2



I cant understand it?? I make sure session_start is in my header(links.php) this gets included on every page. It is at the top on line one and i keep getting the above errors? What am I doing wrong?

Code: Select all

<?php 
session_start();
?>

hellpppppppp!!!

Posted: Fri Oct 26, 2007 9:33 am
by FireElement
I now taken it out of links.php and put it on first like of my index file in hope this world work.

Code: Select all

<?php session_start(); require("links.php"); ?>
I still get the following errors?


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at localhost/index.php:1) in localhost/index.php on line 1

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at localhost/index.php:1) in localhost/index.php on line 1


I really dont know why its not working :(
Any thing would be great thanks!!!

Posted: Fri Oct 26, 2007 9:37 am
by feyd
Search (everywhere) for the phrase "headers already sent"


It comes up quite a bit.

:(

Posted: Fri Oct 26, 2007 10:05 am
by FireElement
I have read:

http://uk3.php.net/function.session_start

I tried putting header at top so nothing calling out else before I dont understand why this error is still happening it does not make sense. The only php I have on my index page is start_session and and a couple of includes which only call html pages.

I really dont get it. This is my page

Code: Select all

<php start_session();

include 'links.php'; ?>

general html code
</body
</html>
links.php basically is this:

Code: Select all

<html>
<head>
<title>my site</title>
//call java files
//call css files
</head>
<body>
<a href="p1">p1</a> | 
<a href="p2">p2</a> | 
<a href="p3">p3</a>
So basically start session is called before anything else. Everytime! I dont get whats messing up?

Posted: Fri Oct 26, 2007 10:07 am
by feyd
It's probably not at the top of the page source.

Posted: Fri Oct 26, 2007 10:17 am
by FireElement
feyd wrote:It's probably not at the top of the page source.
What you mean? The page source would look like this if I took out include. I really dont get this....

<?php start_session();
?>
<html>
<head>
<title>my site</title>
//call java files
//call css files
</head>
<body>
<a href="p1">p1</a> |
<a href="p2">p2</a> |
<a href="p3">p3</a>

general html code...

</body>
</html>

Posted: Fri Oct 26, 2007 10:21 am
by feyd
You need to ensure there is no HTML, text or whitespace prior to the starting PHP tag. Examples of whitespace: spaces, carriage returns, tabs, line feeds, vertical tabs...

Posted: Fri Oct 26, 2007 10:41 am
by FireElement
Am not sure what the hell is going on in my furry I decided to call the same form in to a basic html page. To see if it would work. It seems to work.... I dont understand why it works here.... Its neally the same as my other page...

I have even taken out most the requests out the other page and made it like this page removing the links.php and just sticking what is in this page on the page its still bringing the error... crazy!

Code: Select all

<?php 
session_start();
?>
<html>
<head>

<title>Kenjy</title>

<script language="JavaScript" src="calander/CalendarPopup.js"></script>
<script language="JavaScript">document.write(getCalendarStyles());</script>
<script type="text/javascript">

</head>
<body>
<?php

include "form.php";

?>
</body>
</html>

This is fuked up

Posted: Fri Oct 26, 2007 10:50 am
by FireElement
right so I removed all requests right... basically the page is empty i have start_session at top haha thats it error lmao this weird am total confused....

Posted: Fri Oct 26, 2007 10:53 am
by feyd
Can you put the file(s) online somewhere they can be accessed (and not parsed)?

Posted: Fri Oct 26, 2007 10:54 am
by FireElement
I just

<?php start_session ?>

<?php /*

all the page

*/ ?>

I still get the following error? Am total confused?

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at localhost/share-tips/index.php:1) inlocalhost/share-tips/index.php on line 1

Posted: Fri Oct 26, 2007 10:55 am
by s.dot
That is a bit odd. Why would it say that the output started in index.php if you're on links.php? My guess is you're including this in the index file.

Try not using closing ?> tags at the end of your files, and make sure there's nothing (nothing!) before the starting <?php tag on both pages.

Posted: Fri Oct 26, 2007 10:57 am
by FireElement
unfortunaly I cant put the actual pages up.... normal that would be the first thing I did but as my mate wants no one to know his idea he said not to disscluse any thing on it.... I dont know what to do .... I cant work it out at all

Posted: Fri Oct 26, 2007 10:59 am
by feyd
Then I guess you are stuck.

By the way, please don't attempt to bypass the swear filter again.

Posted: Fri Oct 26, 2007 11:03 am
by FireElement
ok this is so messed up I just put a page with only the following up!

<?php start_session ?>

its located http://www.domain.com/share-tips/index.php

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /data01/mlouret/public_html/share-tips/index.php:1) in /data01/mlouret/public_html/share-tips/index.php on line 1