What is a session in php?

Report
Question
1269 views

A session in PHP is a way to store information to be used across multiple pages of an entire website.

Please explain why do you think this question should be reported?

Report Cancel

A session in PHP is a way to store information to be used across multiple pages of an entire website. The information is not stored on the user’s computer, unlike cookies. In a temporary directory on the server, a file will be created by the session where registered session variables and their values are stored. This information will be available to all pages on the site during that visit.

When you work with an application, you open it, do some modifications, and then you close it. This is much like a Session. The computer knows who you are. It knows when the application is started and ended by you.

But on the internet, the webserver does not know who you are or what you do, because the HTTP address doesn’t maintain a state. This problem is solved using session variables by storing user information to be used across multiple pages (e.g. username, favorite color, etc).

By default, session variables will last until the user closes the browser.

So Session variables hold single user information and are available to all pages in one application.

PHP

Thread Reply

  1.  Atul Upadhyay
    Wed Developer 2 Votes
    2 years ago

    Please briefly explain why you feel this answer should be reported .

    Report Cancel
    store data on server
  1.  Neel
    Full Stack Developer 2 Votes
    2 years ago

    Please briefly explain why you feel this answer should be reported .

    Report Cancel
    A session in PHP is a way to store information to be used across multiple pages of an entire website.
  1. 2 years ago

    Please briefly explain why you feel this answer should be reported .

    Report Cancel
    In Session information is not stored on the user’s computer, unlike cookies.

Leave an comment

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>