Welcome to Techno Smarter QA, Question, Answer forum. Ask questions, receive answers, or help someone. Join Now
+2 votes
in Wordpress by (4k points) 8 29 54

1 Answer

0 votes

Difference between Sessions and cookies in PHP.

Session - Session is a server-side resource that is associated with the cookies information. Session intact the cookies information and the cookies store user information under the client side. The session is not a client-side resource but the cookies are a client-side resource that stored the information under the browser (client side ). 

Cookies- Cookie is a client-side resource. We initiate it for store the login and another user information under the browser. When a user login using cookies and session the session associated with cookies information and log in the account. When the user logs out the account after that session has destroyed. If you close the window directly and log in again that time cookies help you to login account without filling your username and password( All user information+ ) .


  • It is stored the unlimited amount of data.
  • It is holding the multiple variables in sessions.

Cookies - 

  • It is stored limit amount of data. It is only allowing 4kb[4096bytes]
  • It is not holding the multiple variable in cookies. 

Session - You have to need to start the session on every page. 

 The session is more secure because it is stored on the server, we can not easily access it. 

Cookies - You do not need start cookies in every page. 

Cookies are stored on the local computer (client side
) , basically, it maintains user identification means it tracks visitors record.. 


by (9.1k points) 11 25 63
edited by