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 is stateless. You don't get to keep connections across requests.
Stateless Protocols are the type of network protocols in which Client send request to the server and server response back according to current state. It does not require the server to retain session information or a status about each communicating partner for multiple request.
The HTTP protocol is a stateless one. This means that every HTTP request the server receives is independent and does not relate to requests that came prior to it.
Is REST API stateless or stateful? A. REST APIs are stateless because, rather than relying on the server remembering previous requests, REST applications require each request to contain all of the information necessary for the server to understand it.
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:
models-with-persistent-state-between-http-requests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With