<?php if(session_status() == PHP_SESSION_ACTIVE){ //a session is already running session_destroy(); //stops the session } ?>
if (session_status() === PHP_SESSION_NONE) { session_start(); }