How is session triggered in PHP

Session is a mean of storing and accessing data on multiple pages of a website by storing the data on the client’s browser in the form of cookies or appending it to the URL of the web page.

Session is activated when either of the following conditions are met.

  • If the session.auto_start value is set to 1 in the php.ini then the session will be started on the page without needing to explicitly call any session function to start and use the session.
  • Calling the session_start() function at the start of the PHP script will tell the web server that this web page will create and access session data however this will require the programmer to use this function at the start every page where he want to access and use session data.

Be the first to comment

Leave a Reply