warrens0017 Posted June 22, 2018 Share Posted June 22, 2018 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: <?php session_start(); include '../inc/inc.php'; ?> Here is the inc.php: <?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 comment Share on other sites More sharing options...
dsonesuk Posted June 22, 2018 Share Posted June 22, 2018 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 comment Share on other sites More sharing options...
warrens0017 Posted June 22, 2018 Author Share Posted June 22, 2018 I just verified that all the inc files do NOT have the session_start(). Yes this is at the VERY TOP before all HTML tags. Yes there is no line break. Link to comment Share on other sites More sharing options...
Ingolme Posted June 22, 2018 Share Posted June 22, 2018 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 comment Share on other sites More sharing options...
warrens0017 Posted June 22, 2018 Author Share Posted June 22, 2018 I used Visual Studios, NotePad++, Sublime Text; All of them show that there is no UTF-8 BOMs. Link to comment Share on other sites More sharing options...
dsonesuk Posted June 22, 2018 Share Posted June 22, 2018 Do you call the header() function, use php cookies, anywhere in your other scripts. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 23, 2018 Share Posted June 23, 2018 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 comment Share on other sites More sharing options...
warrens0017 Posted June 23, 2018 Author Share Posted June 23, 2018 It had to be BOM. I just deleted the file and recreated it with using just work and then copied and pasted it into a bran new accedit.php page. IDK why my editors were not able to detect the BOM but that was is. Thank you all for the help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now