session() question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

session() question

Post by akimm »

Anyone know what this error might mean?


Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /nfs/cust/8/25/05/650528/web/muk.php:3) in /nfs/cust/8/25/05/650528/web/muk.php on line 4
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

search on our forums "headers already sent".. this has been discussed countless times.
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

ok

Post by akimm »

Will do
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Post by gkwhitworth »

yeah....I actually just dealt with this...you should search first, but to save you the trouble.

session_start() is trying to write to the browser but something on line 4 has done it first. Since your code needs this session...it errors. Anyways...if you plan on having a session place the session at the very beginning of your php code and at the beginning of any page you plan on retrieving the session. For example:

The PHP Script:

Code: Select all

<? session_start()
.....php code goes here.....
?>
The HTML Page where you tell them what they have stored:

Code: Select all

<? session_start()
?>
<HTML>
</HEAD>
....and so on

</BODY>
<?
print ("Your name is: $name<br>");
?>
...and so on.....
That should fix at least that error.

--
Greg
Post Reply