Re: Re: [PHP3] How exactly does PHP work ?
| From: | Rasmus Lerdorf | Date: | Wed, 21 Jun 2000 00:14:31 +0000 |
| Subject: | Re: Re: [PHP3] How exactly does PHP work ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2409@lists.php.net to get a copy of this message | ||
> In article <3949EA44.34C34C37@t-edge.com>, mandar@t-edge.com (Mandar
> Deshmukh) wrote:
>
> > I wanted to know, on each new user accessing a php page, what is
> > created on the server? :
> > 1) a object,
> > 2) a thread,
> > 3) a process
> > Learning something about this will give me a clearer picture of php
>
> Using PHP as a Module, I think maybe just a thread, if that much, is
> created. I guess it has to create some sort of discrete thing, since one
> PHP incarnation on a server is independent of another...
It's not a thread. With Apache-1.3 on UNIX each httpd is a separate
process. PHP as an Apache module is simply part of this httpd
process. When Apache recognizes that it needs to treat a file as a PHP
file it simply calls a function within its own process space which then
brings the execution into the PHP part of the Apache process.
So, you have a single-threaded httpd process where PHP is simply part of
the process and the single thread moves around within this process. When
Apache is waiting for a request the execution thread is in the Apache part
of the code sitting around listening on a socket. When PHP stuff is going
on the execution thread is inside the PHP part of the process.
> Using PHP as CGI, a whole new process is created each time. That much I
> know for sure.
That's correct.
-Rasmus