PHP_VERSION_ID is available as of PHP 5.2.7, so check this first and if necessary , create it.
session_status
is available as of PHP 5.4 , so we have to check this too:
if (!defined('PHP_VERSION_ID')) {
$version = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}else{
$version = PHP_VERSION_ID;
}
if($version < 50400){
if(session_id() == '') {
session_start();
}
}else{
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
}