Hi,

I am getting the following error in my index.php:

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

I checked my code and my session_start() is the first line. cany anyone help please...

this is my index.php:

<?php
	include("php_header.php");
    include("connect2db.php");	
?>
<!DOCTYPE html>
<html lang="en">
<head>

and this is my php_header.php:

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

// report all errors;
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE);
?>

    Are you calling [man]session_cache_limiter[/man] somewhere in your code? session_start sends a different header than session_cache_limiter and this error is from the latter. I would check for that, and also notice if you are using it the man page says:

    php.net wrote:

    The cache limiter is reset to the default value stored in session.cache_limiter at request startup time. Thus, you need to call session_cache_limiter() for every request (and before session_start() is called).

      Nope. I never use session_cache_limiter

        Do you have Byte Order Marks at the start of your files?

          Yeah, the "output started at /home/meskholdings/meskholdings.com/jobs/index.php:1" part of the error message would suggest a BOM (or some other non-printing character) before the opening php tag.

            BOM? can I just put the <!DOCTYPE html> at the top followed by the <?php tag?

              Nope, there can be no characters output before the call to session_start(), as doing so prevents any more headers (including the session cookie) from being sent.

              BOM (byte order mark) is a character(s) at the very start of a unicode file, though it's optional in utf-8. If you are saving your PHP files as utf-8, you need to ensure that your code editor is not including the BOM.

                My problems is solved. I used Save As in Adobe Dreamweaver and unchecked Include Unicode Signature (BOM).

                Thank you so much

                  Write a Reply...