-2

Possible Duplicate:
Headers already sent by PHP

Iam trying to develop a web application it show a warning as

Warning: session_start() [function.session-start]: Cannot send session cache limiter - >headers already sent (output started at /home/wwwwdmar/public_html/index.php:1) in >/home/wwwwdmar/public_html/index.php on line 1

This is the top side codes of the index page.

<?php session_start();
require "config/database.class.php";
//  require 'fbook/src/facebook.php';
require "core/corefunction.php"; 

$selectrecentproducts = "SELECT listitemname,rollover,productkey,category_name,sub_category_name FROM ".$tbl_products."   INNER JOIN ".$tbl_main_categories." INNER JOIN ".$tbl_sub_categories." ON ".$tbl_products.".categoryname=".$tbl_main_categories.".category_id AND ".$tbl_products.".sub_category_id=".$tbl_sub_categories.".sub_category_id  WHERE status= 0 ORDER BY product_id DESC LIMIT 8";
//echo $selectrecentproducts;exit;

Please take a look in it

Community
  • 1
  • 1
user1431849
  • 499
  • 1
  • 4
  • 7

2 Answers2

0

The problem is PHP is sending some data before starting session_start() which is illegal. You should fix the problem [I dont know what the problem is as you have not shared all of your code] or you could try error reporting to 0 before session_start()

Sourav
  • 17,065
  • 35
  • 101
  • 159
0

session_start() must be called before ANY output is sent to the browser. This includes whitespace. Make sure you are NOT sendin ANYTHING before that call. The same applies to header and setcookie.

You can "cheat" by calling ob_start() as the first thing, then you don't have to worry about it. However, bear in mind that this adds overhead, so you should only really use this solution if you actually make use of ob_start()'s features.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592