tags:

views:

38

answers:

3

on my pages I get the following warning:

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

My code says:

<?php session_start();
require_once("lib/lib.inc.php"); 
$form_page = "Compensation-Claims";
?>

The page works fine but I want to turn the warning off so that visitors dont see the warning. I removed the code that says:

error_reporting(E_ALL);
ini_set("display_errors","1");

any ideas?

+1  A: 

You have to do your session initialization before you send anything to the browser. So if you print anything before it will give you similar errors.

AlyxVF
+1  A: 

Putting @ before session_start(); should suppress the error, even though it would be better to fix the root cause (which is data being output to the browser before session_start(); is called.

Meep3D
Thanks for that!
Ian
A: 

Make sure the php start tag (<? , although you should really be using <?php instead) is the first character in the first line of the file.

Alternatively you can enable output_buffering in php.ini

MGriesbach