I started developing a platform mainly in php and sessions worked fine, until I stopped my Apache Server and started working on it a week later.
This is my problem :
include_once 'backend/login.php'; // DB connect + functions
include_once 'menu.php'; // menu include
check_logout(); // check if user logged out
include_once 'widgets/widgets.php'; // widgets : login, agenda, events, languages
include_once 'footer.php'; // footer
include_once 'backend/login.php'; // connect to DB, login functions
include_once 'backend/load_feed.php'; // feed functions
include_once 'menu.php'; // include main menu
alert("<?php echo $_SESSION['first_name']; ?>");
check_login(); // ensure user is logged in
remote script used to conenct to the database
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "DB";
// create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// check connection
die("Connection failed : " . $conn->connect_error);
<?php session_start(); include_once 'backend/login.php'; include_once 'menu.php'; check_logout(); include_once 'widgets/widgets.php'; include_once 'footer.php' ?>
I Hope This works & also do one thing, the list of files you have included above please make sure that you haven't called session_start() again in that files also, actually it doesn't matter but still give a try.
Also as you are saying that the function is giving problem, please also post the snapshot of the error so that it would me more helpful to understand the error.