php check if session started
snippet in php

php check if session started

user7660

<?php
if(session_status() == PHP_SESSION_NONE){
    //session has not started
    session_destroy();
}

php check session status

user9918

session_status();

// Possible results:
//  - PHP_SESSION_DISABLED = 0
//  - PHP_SESSION_NONE     = 1
//  - PHP_SESSION_ACTIVE   = 2

php start session if not started

user6075

#you could just ignore warnings messages
@session_start();