Jump to content


Photo

Quick Question [SOLVED]


  • Please log in to reply
4 replies to this topic

#1 SLG

SLG
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 30 October 2006 - 10:14 PM

Hey all,

I am a bit noob to PHP/MySQL (I just started a few weeks ago). Anyway, I am a webmaster for the site AlbinoShades, and I am about to release the new version of the site soon. This new site has a login feature that was a serious pain in the ass to get working. Well I finnaly got everything up and running, and started intergrating the script into the site, then this ugly error appeared at the top saying:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/albinosh/public_html/rc2/home.php:5) in /home/albinosh/public_html/rc2/include/session.php on line 47

But then everything else worked, I could login, password protect pages, edit admin settings etc. So I looked at line 47 in sessions.php and saw this line:
start_session()
I knew that editing this would screw up the script, but I couldnt resist, I commented that line, then the ugly error went away, but I couldn't login. So I un-commented that line, and same thing happens. Any ideas why this error message is showing?

#2 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 30 October 2006 - 10:20 PM

start_session() has to be at the very top of any script in order for it to work or you will get errors like that.. so right at the top of the script before anything put:
<?php
start_session()
?>
let me know if it works after this..

#3 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 30 October 2006 - 10:24 PM

You want to make sure that therer are no blank lines before "session_start()" and that is the first thing on the page. Also...

<?php

  session_start();
    
  ob_start();

?>

Sometimes adding the ob_start() function can address other header related issues.
PHP Ninja

#4 SLG

SLG
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 30 October 2006 - 10:26 PM

so would I put

  session_start();
    
  ob_start();

on the top of home.php or sessions.php?

#5 SLG

SLG
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 30 October 2006 - 10:31 PM

Never mind I got it! The  ob_start(); did the trick! Thank you all for the help! You guys rock!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users