Difference between PHP Session and Cookies



In my previous post I have described regarding the PHP Session and PHP Cookies,here In this post I am trying to define the main differences between the Session and Cookies. The differences are given below point wise:

1. The main difference between cookies and sessions is that cookies are stored on the user’s computers in the text file format, and sessions are stored on the server.
2. A Cookies can keep the information on the user’s system untill deleted whereas Session stored the information while the user has their browser open.
3. Session can hold multiple variables, whereas Cookies can not hold multiple variables.
4. Session data is stored in a cookie with an expiry date of zero, That means the session only remains active as long as the browser is open,after closing the browser, all the stored information is lost. You can modify this behavior from the php.ini file set the session.cookie_lifetime from zero to your specific value you want.
5. Sessions are stored on the server, that means clients do not have access to the information you stored about them, so that it is secure and the cookies are stored on the system so that information stored into it is not so much secure as the session values.

Wants to read more about the Session click here? or you need more information regarding the Cookies click here.

These are the main basic differences regarding the Session and Cookies, Thanks and Enjoy the reading