Friday, 2 January 2015

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

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

No comments:

Post a Comment