// For PHP versions > 5.4.0 if (session_status() === PHP_SESSION_NONE) { session_start(); } // For PHP Versions < 5.4.0 if(session_id() == '') { session_start(); }