I have a three PHP scripts (logout.php, index.php, session.php) that I use in a larger application. I incorporated session.php (to serve as a mechanism to control preserving page view for pressing back button on the browser).
I am trying to make the logout.php clear cache and the logged in user info on the webpage but no matter what I do I can not seem to logout. That is, the user still remains on my page as logged in.
How can I logout to ensure that the user does not appear as logged in on my index.php page?
session.php
<? 
  session_cache_limiter('public');
  session_start();
?>
logout.php
<?php
    session_start();
    $_SESSION['expire'] = "<META HTTP-EQUIV=\"EXPIRES\" CONTENT=\"Mon, 02 May 2015 21:00:00 GMT\">";
    header('Location: index.php');                                             
?>
beginning of index.php script
<?php   
    session_start(); 
    if (isset($_SESSION['expire']))
    {              
        echo $_SESSION['expire'];
        session_unset();
        session_destroy();
        unset($_SESSION);
    } 
?>
Error Log shows the following each time I try to logout.
PHP Notice: A session had already been started - ignoring session_start() in index.php on line 6 <-- this is referring to where I have session_start() in my if block in my local code.
EDIT - Modified index.php
<?php
    if (isset($_SESSION['expire']))
    {      
        session_start();        
        echo $_SESSION['expire'];
        session_destroy();
    } 
    else
    {
        require_once('session.php');
    }
?>
Latest index.php script
<?php
    if (session_status() === PHP_SESSION_NONE)
    {
        require_once('session.php');
    }
    else
    {
        session_start();  
        if (isset($_SESSION['expire']))
        { 
            $expire = $_SESSION['expire'];
            session_destroy();
            echo $expire;
        }
    }
?>
 
    