Jump to content

Archived

This topic is now archived and is closed to further replies.

SLG

Quick Question [SOLVED]

Recommended Posts

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:
[code]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[/code]

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:
[code]start_session()[/code]
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?

Share this post


Link to post
Share on other sites
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:
[code]
<?php
start_session()
?>[/code]
let me know if it works after this..

Share this post


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

[code]<?php

  session_start();
   
  ob_start();

?>[/code]

Sometimes adding the ob_start() function can address [i]other[/i] header related issues.

Share this post


Link to post
Share on other sites
so would I put

[code]
  session_start();
   
  ob_start();[/code]

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

Share this post


Link to post
Share on other sites
Never mind I got it! The  ob_start(); did the trick! Thank you all for the help! You guys rock!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.