Php A Session Had Already Been Started

Last modified: 
Tuesday, May 5th, 2015
Topics: 
PHP

Problem

PHP generates the following notice: A session had already been started - ignoring session_start().

Solution

Check that $_SESSION is not already set before starting a new session.

<?php
if (!isset($_SESSION)) {
    session_start();
}
?>


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.