Any body can explain me how session works in PHP. for eg. 3 customers drenched into gmail. the way the server identifies these 3 uers. do you know the internel process behind that.

Periods comprise two components:

a) Cookie

b) Server-side session data

The cookie usually consists of a session id, which references where around the server to obtain the session data from. The server then uses this session id to fetch the information in the server that is contained within personal files which has the matching title because the session id.

You are able to tweak session behavior through the various [cde] functions.

Gmail uses Python I believe, not PHP.

PHP automatically creates its periods towards the session_ directory. It may be set up to keep the periods within the database.

It identifies the periods using a cookie, but may also be set up to pass through a question string but it's very ugly.

Periods are a mix of a server-side session data along with a client-side cookie, using the client-side cookie that contains nothing apart from a mention of correct data around the server. Thus, once the user visits the website, their browser transmits the reference code towards the server, which loads the related data.

This might appear a little clumsier than simply getting a customer-side cookie with your data in, but you will find a couple of advantages:

  • Your server-side session data can contain large levels of data without any hassle - client-side snacks are limited in dimensions
  • The consumer-side cookie consists of nothing apart from a little reference code - because this cookie is passed each time someone visits a webpage in your site, you're saving lots of bandwidth by not moving large client-side snacks around
  • Session data is a lot more secure - only you'll be able to manipulate it, instead of client-side snacks that are editable by all

It's also worth noting that periods only last up until the user shuts their browser, whereas snacks could be set up to keep going longer. However, apart from the above mentioned, there's very little distinction between session data and cookie data for many reasons.

The following is an extremely piece of content which describes how periods and snacks work within PHP.

Periods are extremely straightforward.

After I login for your site, PHP sets a typical browser cookie having a "session ID" — usually an alphanumeric string like /tmp.

Just like all snacks, my browser will be sending that cookie to your server with every request I make. Thus, the application now recognizes that every request that accompany a session ID of 63f1a67cf52b5d2bbd0cbef45e18b242 originates from me.

Thus, if you want to store any details about me, you can preserve tabs on it under 63f1a67cf52b5d2bbd0cbef45e18b242. Automatically, PHP stores these details in files within the 63f1a67cf52b5d2bbd0cbef45e18b242 directory, if you can override might store it anywhere you want (e.g., inside a database). What matters is associating that session ID having a particular user.

I'd rather not oversimplify things. You will find some concerns (like, let's say an burglar sees my unencrypted session ID and begins utilizing it themself — he could certainly start masquerading as me), and you will find some methods to ease individuals concerns. However the fundamental mechanism of storing a session ID inside a cookie and taking advantage of that to recognize details about me saved around the server is fairly universal.

A cookie.
Or perhaps a parameter within the url. Which internet process is known as HTTP protocol.