Re: mod_php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2010-08-20 17:10, Bostjan Skufca wrote:
> Yes, this is correct.
> 
> If you look at sapi/apache2handler/sapi_apache2.c in PHP sources, you will
> find that PHP SAPI registers it's function php_handler() within apache. This
> function gets called every time PHP is requested by some client (with
> appropriate configuration, of course).
> 
> I must admit that PHP-DEV (INTERNALS) seems more appropriate list for such
> question :)

1. What optimizations does PHP interpreter make? I guess it should be
able to check file modification time and cease to compile it again and
again. Is this correct?

There is some bytecode form, right?

What else does it do? For instance if there is a big, immutable class in
the application (say it contains a bunch of constant XML documents,
hardcoded into the source): will the interpreter notice that and
instantiate this class only once across multiple requests?

What if this class generates side effects (like printing "hello world"
in the constructor) and what if it doesn't?

2. I guess PHP application wide cache is quite a different story? For
the worker processes are separate... Or maybe PHP interpreter itself
provides any means for that??

3. Does PHP interpreter maintain any state across different requests
within the context of a single Apache worker process? If so, what does
this state contain?

4. Does PHP interpreter maintain any global state within the context of
a single Apache HTTP server instance? If so, what does this state contain?

5. What about system wide PHP interpreter state?...

6. I heard some nasty rumors that PHP interpreter resource management is
somewhat problematic (memory leaks, or something), and because of that
those Apache worker processes have to be killed from time to time.

Could you please comment on this?

> 2010/8/20 Stanisław Findeisen <stf@xxxxxxxxxxxxxxxxxxxxxxx>
> 
>> Hi
>>
>> Could anyone please explain to me the basic architecture of PHP module
>> when running "in process" within Apache HTTP server?
>> I guess this is called "mod_php".
>>
>> As far as I understand the shared library (e.g., libphp5.so) is being
>> dynamically loaded by an Apache working process and then, whenever a
>> .php (or .php3, or...) file is requested the working process calls the
>> PHP interpreter. This call to the PHP interpreter is a function call and
>> there is no fork(2) nor execve(2) in play at all.
>>
>> Is this correct?

STF

http://eisenbits.homelinux.net/~stf/
OpenPGP: DFD9 0146 3794 9CF6 17EA  D63F DBF5 8AA8 3B31 FE8A

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux