472,146 Members | 1,434 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

error with sessions and headers being sent, yet nothing but headers have been sent

I'm getting this error:

Warning: session_start(): Cannot send session cache limiter - headers
already sent in
/home/httpd/vhosts/publicdomainsoftware.org/httpdocs/pdsIncludes/McSessionInfo.php
on line 34

This is line 33 to line 36 of that class:
function startSession() {
session_start();
session_register();
}

Why would this generate an error?

Jul 17 '05 #1
3 1569
>I'm getting this error:

Warning: session_start(): Cannot send session cache limiter - headers
already sent in


Don't send ANYTHING before you call session_start().
No blank lines (these are very often difficult to notice).
No debug code.
No DOCTYPE.
No error or warning messages from functions that complain.
(like access to uninitialized variables).
No HTML.
Gordon L. Burditt
Jul 17 '05 #2
On 2 Jun 2005 13:01:15 -0700, lk******@geocities.com wrote:
I'm getting this error:

Warning: session_start(): Cannot send session cache limiter - headers
already sent in
/home/httpd/vhosts/publicdomainsoftware.org/httpdocs/pdsIncludes/McSessionInfo.php
on line 34

This is line 33 to line 36 of that class:

function startSession() {
session_start();
session_register();
}

Why would this generate an error?


What version of PHP are you on? Typically that error message also includes the
location that first produced the output, _as well as_ the line that failed
because headers have already been sent.

Don't know if the additional information is version specific...

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #3
put an ob_start() in the 1st line, this will prevent the sending of any
ouput

ob_end_clean() just above the session call will discard the buffer and
allow your session to start clean

for debugging you could use ob_get_clean(), returns the sent output as
a string to examine

micha

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by y_oda2002 | last post: by
6 posts views Thread by Peter Frost | last post: by
12 posts views Thread by D. Shane Fowlkes | last post: by
3 posts views Thread by Tomasz Nowak | last post: by
4 posts views Thread by XML newbie: Urgent pls help! | last post: by
5 posts views Thread by Collector | last post: by
22 posts views Thread by magic_hat60622 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.