By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,180 Members | 1,012 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,180 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
>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

P: n/a
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

P: n/a
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.