Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does PHP initiates new object for each user

I am sure some devs are bit confused about that does PHP initiates new object for each user visiting the site.

Eg: if 100 users shopping on e-commerce website, how many objects are creating during their visit

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Let me try to explain.

Whenever a browser calls an url like the one of your e-commerce website, a webserver is receiving the request and decides what to do with it. In this e-commerce case the request goes to something like the FastCGI Process Manager (FPM) which will handle the PHP part of request and returns the result to the webserver and back to the browser again.

The FPM starts a single session for every incoming request. If the browser receives an answer, the request were answered an the session that handled the request is gone.

Therefore, yes, if 100 people visiting your e-commerce shop even in parallel, you create 100 times objects since every request from the browser is handled by a single session.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading