Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


Anibor

25 posts

Geek


#68955 30-Sep-2010 12:29
Send private message

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\psAdmin\index.php:53) in C:\xampp\htdocs\psAdmin\inc\logincheck.php on line 14

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\psAdmin\index.php:53) in C:\xampp\htdocs\psAdmin\inc\logincheck.php on line 14

the only php that is on my index page is:
               
            $page = $_GET['page'];
            if ($page)
            {
                include("inc/".$page.".php");
            }   
            else
            {
            include("inc/login.php");
            }
           
           
        ?>

but im thinking that somehow this is stopping me from using session_start() on my login page...

Any suggestions?

Create new topic
Kraven
729 posts

Ultimate Geek


  #386291 30-Sep-2010 12:37
Send private message

What else is on your index page? Is there HTML above the first '<?php' tag?

You should be including session management as one of the first things on your script.



Anibor

25 posts

Geek


  #386298 30-Sep-2010 12:53
Send private message

Yeah theres some html but i wouldnt have thought that would interfer with the php. What is session management?

Im a total noob at php

nate
6473 posts

Uber Geek

Retired Mod
Trusted
Lifetime subscriber

  #386325 30-Sep-2010 13:51
Send private message

Anibor: Yeah theres some html but i wouldnt have thought that would interfer with the php. What is session management?


Session info (such as cookies) are sent out first in a page request.  What Kraven is saying, is anything you set in the session must be done first, before any print or echo is done to the screen.

If you do have something print to screen and then set something in the session, you will get the errors you are receiving :)



FeralReason
1 post

Wannabe Geek


  #386569 1-Oct-2010 05:53
Send private message

This error is generally caused because, somewhere in your code -- an include file perhaps -- you are calling session_start() after some output has already gone out.  One of the following should solve this problem:

1) Make sure session_start() is called before ANY other information is sent. Place it before any includes.
2) If this doesn't work, create a stripped down test file (basically one that does nothing but the session_start()  ) and test it again. If the stripped down test file does not work, try changing to a different encoding. In my environment "UTF-8 With BOM" DOES NOT WORK, while either "UTF-8 without BOM" or ANSI works fine.
3) If there is some reason (I can't think of one) to output something before calling session_start(), you might try putting ob_start() at the beginning of the file and ob_flush() at the end. This buffers the output and may allow session_start() to work -- but this is more of a work-around than a solution.
4) Using @session_start() does not solve the problem. It simply supresses the warnings so that you don't see them.

Let me know if this does not solve your problem.

Olliepop
1 post

Wannabe Geek
Inactive user


  #389312 7-Oct-2010 19:37
Send private message

Change

session_start()

too


if(!isset($_SESSION))
{
session_start();
$_SESSION['start'] = true;
}


indpurvesh
1 post

Wannabe Geek


  #390397 11-Oct-2010 11:20
Send private message

Usually this happen because you had a echo statement before or  possibly a white pace when you start and end <?php  or ?>  tags.


Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.