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

Cannot send session cache limiter - headers already sent

P: 1
Hello,

I know that you guys are familiar with this, but I tried almost every solution I googled, but no chance getting it wroked, here is the error.


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/admin/public_html/xxx/xxx/userclass.php:62) in /home/admin/public_html/xxx/xxx/sessiondata.php on line 28

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/admin/public_html/xxx/xxx/userclass.php:62) in /home/admin/public_html/xxx/xxx/sessiondata.php on line 28

and here is the sessiondata.php lines, that have the error.
Expand|Select|Wrap|Line Numbers
  1. if ($sessionFileDir != "") {
  2.   session_save_path($sessionFileDir);
  3. }
  4.  
  5. if ($SID == "") {
  6. session_start();
  7.   $SID = session_id();
  8. } else {
  9.   session_start($SID);
  10. }
  11.  
Hope I can get any help soon.
Dec 8 '07 #1
Share this Question
Share on Google+
1 Reply


Atli
Expert 5K+
P: 5,058
Hi. Welcome to TSDN!

You get this error when you try to start a session after something has been printed (or echoed) to the response.

The session_start function must be called first, before anything is added to the response. Once you start adding to the response the headers are locked, and the session can not be started.

If you can in no way modify your design so the session_start function gets called first, then check out the Output Control functions.
Dec 9 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.