Along the same lines that for java centric applications, Play framework is stateless and lift framework is stateful as is any servlet or Java EE container like Tomcat or GlassFish is statefull, is PHP web framework like zend or cake php stateless or stateful and why?
PHP by itself has no state. Each request is completely unique. It's very close to the bare metal of HTTP in this regard.
To implement state on top of that you can use sessions, databases, shared memory, files or anything else that somehow retains state. Frameworks like Zend or Cake offer abstractions for these mechanisms that make it appear stateful out of the box to varying degrees. PHP is never truly keeping state though.
It is not all about Java or PHP. HTTP is a stateless protocol.
To make it stateful, the developer (programmer) has to make sure that all relevant information is stored and make sure that all relevant information is read back in when the script is called upon.
Most of the servers provide session management for stat management.
As to why stateless - stateful session add significant memory and performance overhead see:
The only 'state' thing in a web application is what's stored persistently somewhere (like a database), the web request-response flow is stateless. It takes from or puts to the persistent storage so it behaves like as if it's stateful. IMHO, session and cookie are included in this persistent storage.
© 2022 - 2024 — McMap. All rights reserved.