Definition | Cookies are small pieces of data stored on the client-side (browser). | Session is a way to store information on the server to be used across multiple pages of a web application. |
Storage Location | It is stored on the client-side (browser). | It is stored on the server-side. |
Data Size | It is limited in size (usually 4KB). | It can handle larger amounts of data as it is stored on the server. |
Security | It is less secure as data is stored on the client. | It is more secure because data is stored on the server. |
Usage | It is used to store data like user preferences, login status, or small pieces of information. | It is used to store sensitive or larger amounts of data like user authentication information. |
Setup | It is set using setcookie() function. | It is set using session_start() function. |