I have had a good search on Google and on StackOverflow to see if anyone else has experienced this and I can't seem to find an answer.
Basically I'm in the late stages of developing my website on a local server and I've got one bug that I can't seem to squash.
Every so often when I load one of the pages I get a SESSION NOT STARTED message which comes from:
if (session_status() == PHP_SESSION_NONE) { die('SESSION NOT STARTED');
}//SESSION NEEDS TO START TO CHECK USERS
This is located in header.php, which is called on index.php after the body opens. (Just in-case the session doesn't start or I forget and errors get chucked everywhere.)
Right at the top of index.php (and every other page) session_start(); opens the session, so the session has definitely started... as so;
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
//Connect MYSQL
include 'mysql_conn.php';
include 'functions.php';
//START SESSION
session_start();
The message disappears if you refresh the page and I can't seem to re-create it by clearing cache / restarting browser / using private browsing or anything like that.
I was thinking maybe its setting it off when a "new" session is started maybe, unless I'm just doing it wrong? Its so rare that its hard to pinpoint what exactly is causing this.
Or should session_status be called before any form of output?
Thanks, any help appreciated
Edit: Running PHP 5.6.28