PHP session_start() function: Why I need it everytime I use anything related to PHP sessions
Why do I need to use session_start() function everytime and in every page where I am doing something related to sessions?
So PHP knows which session to destroy. session_start()
looks whether a session cookie or ID is present. Only with that information can you destroy it.
session_destroy() destroys the active session. If you do not initialized the session, there will be nothing to be destroyed.
In the default configuration, PHP Sessions operate off of the hard disk. PHP asks you to explicitly tell it when you need this support to avoid unnecessary disk IO.
session_start()
also tells PHP to find out if the user's session exists.