Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at W:\www\prads_website\index.php:15) in W:\www\prads_website\inc\adminloginpage.php on line 2

Hi everyone, I am new to all this so I do apologise if ive made silly mistakes.

I keep getting this message and ive banged my head searching through google for an answer so is there anyone here that can help me. I am aware of white spacing. the php on line 1 is <?php
2 is session_start();

What is getting sent before the session start.

thanks in advance to anyone who can help.

Recommended Answers

All 3 Replies

This should be made a sticky. It means there is html or binary output before the function session_start(). Some IDE's put a binary code at the beginning of the file causing this error but one of the more common reasons is that you have some white spacing just before the <?php on line 1. So make sure there isn't even a space before the <?php.

if you have:

<?PHP
session_start();
//rest of code
?>

that won't work as there is a space.
if there is no spaces try

<?php
if (!isset($_SESSION)) {
  session_start();
}

get in the habbit of using if it is not set, then start.
i found this can also be a problem when you try to start an already started session.
hope this is helpful. if not, please paste some more code.
if you use the code button up top it helps too :)

thanks guys for your quick replies really appreaciate it, anyways the problem was that I had this at the very top of my index page I didnt know that I had to include a session start on this page also.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

New code:
LINE1: <?php session_start();?>
LINE2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

works perfectly now.

this site has been more helpful than my tutor has keep up the good work.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.