Re: How php works?

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

 



On 12/13/06, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote:

Kai Xiang wrote:
> Hello all:
>
> I'm new here and looking PHP these days, howerver , I'm confused by how
it
> works, and here is some questions I have.
> Is there any old bird wanna help me out?
>
> 1. I heard there is a zend engine inside PHP playing the role as a
virtual
> machine, and PHP excution have 2 step, first compile to opcode and then
> excute the opcode,
> so is that means the php are compiled only once per file? or still need
to
> recompile when another request issued to the server? also I heard about
the
> caching extention about php, is it talking about caching the opcode?
is't
> caching the opcode or excute results? how it shares between the
requests?

there are opcode caching mechanisms available (e.g. php.net/apc - which
needs to
be installed via 'pecl'**); however the standard php installation will not
do any
opcode caching (i.e. compilation to opcode is done at each request).

** pecl.php.net / pear.php.net


That sounds good, I can take a more look at it


>
> 2. Is there some alternative choise except zend engineen, why need a
zend
> engine? for performance advantage or just easy for porting to different
> platform?

no, there is no plugin replacement for the zend engine and AFAIK the zend
engine
is not used in any other products apart from php ... maybe zend.com has an
article on what exactly the zend engine is (I have never really bothered
to
find out myself :-).




> 3. Take linux apache for example, if compiled as a apache module, and
using
> prefork threading model, for example, if I have 100 process, is that
> means I
> have 100 copy of PHP library local data(I assume only one reentrant
> excutable image) in each process? compare to a worker model, like 10
> process
> and 10 threads in each one process, should it make a difference that we
> only
> have 10 copy of PHP library local data ?

php is not threadsafe (well actually some php extensions are not thread
safe ...
it's an unknown quantity) the prefork worker module for apache2 is the
only
recommended way to go (if running as an apache module)

you might want to look into the FastCGI SAPI if you need a speed boost ...
I can't tell you anything about it because I have no experience with it as
such.

>
> I'm not sure if this is the right place to talk about this, anyway, if
you
> know a better place, help me out :)

this is the place - always best to ask here first; if what your asking is
better aimed at the developers list someone here will point you in the
right direction.


That's fine, thanks


Thanks in advantage
>
> Regards
> Kai
>



[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