Notice (8): A session had already been started - ignoring session_start()

Leave a Comment
If you are going start a session that's already started you will get the following php notice error.
Notice (8): A session had already been started - ignoring session_start()
So it's better idea to check the session using  session_status() and PHP_SESSION_NONE functions, before you going to start.

Safe way to start php session.

if (session_status() == PHP_SESSION_NONE) {
      session_start();
}

x

0 comments:

Post a comment