Search code examples
phpplayframeworklift

Is PHP or PHP based web framework stateful or stateless?


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?


Solution

  • 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.