Jump to content

session_start(): cannot send session cache limiter

Recommended Posts

Good day everyone,

I am running into this error: Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/.../accedit.php:1) in /home/.../accedit.php:2";

i have looked it up but all I am getting is there is white space that is causing this issue. This is the top part of this code:

include '../inc/inc.php';

Here is the inc.php:

include "../inc/dbh.php";
include '../inc/header.php';
include '../inc/bg_img_page.php';
include '../inc/nav.php';
include 'info_get.php';
include 'info_set.php';
include 'info_edit.php';
include 'info_view.php';


Link to post
Share on other sites

It is at the very top of document before the doctype and any html whatsoever, yes! Also none of the other included files do not include session_start() either, yes! And theres definitely no line break, space before <?php or space after. Any of these will cause already open header error.

Link to post
Share on other sites

According to the error message, output started on line 1. It could be that your file is encoded as UTF-8 with a Byte-Order Mark (BOM). The BOM are three bytes that appear at the beginning of the file and may be invisible in your editor. To make sure this does not happen, open the file in a code editor and make sure that the encoding of the file is UTF-8 without a BOM.

Link to post
Share on other sites

It's saying that the output starts on the line before you use session_start, and the only thing you're showing on that line is the opening PHP tag.  Assuming there is not a space before the opening PHP tag, it's got to be the BOM.  The BOM does not appear as a character in the text editor, but it's there when it saves the file, and like anything else outside of the PHP block, PHP will send all of that as output to the browser.  You need to explicitly save without the BOM.  In Sublime, that's File -> Save With Encoding -> UTF-8.  When you open a file without a BOM in Sublime and just hit save, it will not add the BOM back if it isn't already there, you don't need to always save files like that after you do it once.  Although other editors might add it back in without you telling it to.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...