Re: How php works?
| From: | Kai Xiang | Date: | Thu, 14 Dec 2006 01:17:09 +0000 |
| Subject: | Re: How php works? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-245815@lists.php.net to get a copy of this message | ||
Thanks Jochem, Roman :)
On 12/13/06, Jochem Maas <jochem@iamjochem.com> wrote:
Kai Xiang wrote: On 12/13/06, Roman Neuhauser <neuhauser@sigpipe.cz> wrote:how# maillist.kai@gmail.com / 2006-12-13 14:15:26 +0800:I'm new here and looking PHP these days, howerver , I'm confused bythenitworks, 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 avirtualmachine, and PHP excution have 2 step, first compile to opcode andexcute the opcode, so is that means the php are compiled only once per file? or stillneedabouttorecompile when another request issued to the server? also I heardCan you tell it more detail, opcode caching cache the compiled opcode, so not any compile needed anymore if no source changed? what about results, what kind of methdology it's taking? you can get a good idea of APC from the changelog:thecaching extention about php, is it talking about caching the opcode?is'tcaching the opcode or excute results? how it shares between therequests? Both kinds of things exist, with different sharing strategies.http://pecl.php.net/package-changelog.php?package=APCZend als offers opcode caching as part of their suite of products ... Im not all to familiar with Zend's stuff but no doubt their website has plenty of info.3. Take linux apache for example, if compiled as a apache module, andweusingprefork threading model, for example, if I have 100 process, is thatmeans Ihave 100 copy of PHP library local data(I assume only one reentrant excutable image) in each process? compare to a worker model, like 10processand 10 threads in each one process, should it make a difference thatusesonlyhave 10 copy of PHP library local data ?Practical concerns make your question moot: even if the basic distribution was all threadsafe, you're bound to hit a library thatSo it is not a good idea to use worker and php module at the same time, but correct - stick with the prefork module with apache, I believe *think* it is possible to safely use a threaded module if you decide to go the FastCGI route but I maybe thinking this because I completely misunderstood what someone was saying about FastCGI (I remember reading quite abit about FastCGI in posts made to internals@lists.php.net by core-dev/Zend-Founder Andi Gutmans - although I can't say I understood everything I read!) if no threadsafe problem , maybe my thinking is right? Btw, I thought strerror in libc were thread-safe.strtok(3) or strerror(3), or static variables. How much of the code you rely on is labelled by its authors as threadsafe?