Why have the developers of PHP neglected convenient features such as multi-threading,
shared objects and thread synchronization? Obviously, they were aware of such possibi-
lities and they were capable enough to implement them. But they left them out by design.
The underlying idea is !°shared nothing!° architecture. Each request can be regarded as i
it were the only one on the system. Process management and isolation is handled entirely
by the web server. While a number of limitations are inherent to this design, its great
advantage is simplicity.
Another advantage is scalability. It is technically very hard to scale Java applications that
use session objects, as they are live Java Objects that contain code and data. They can be
accessed at any time by any number of processes and ¨C in a cluster ¨C from any number o
cluster nodes. There are solutions to this in the Java world, but they are quite complex and
often ineficient. In PHP, objects do not survive requests. Since every request is handled
independently, it is very easy to distribute PHP applications across many servers for load
balancing or fail over.
Resources opened by PHP also do not live longer than one request. Allocated memory is
released and open connections are closed when the request is complete at the very latest.
As PHP cleans up after completed requests, a badly coded script cannot kill the whole
server.
If you have a background in Java ¨C as does the author ¨C you may not think this is -
ough to build a scalable web application. Yet there are many examples of large, highly
complex projects serving heavy trafic that use PHP. If you adhere to mainstream PHP
practices, you will always be able to ind much larger projects that relect best practices
and have been running successfully for months or years.

hotfile download: php is not java session management whiteaper