php4/zend require/cache details needed

From: Date: Thu, 07 Oct 1999 23:26:19 +0000
Subject: php4/zend require/cache details needed
Groups: php.version4 
Request: Send a blank email to php-version4+get-5356@lists.php.net to get a copy of this message
Sorry if this is a duplicate question for those of you on the other mailing list. I'm hoping someone who really understands the PHP4/Zend interpreter/compiler can answer my question. I'm architecting a fairly large-scale web development project. This project consists of large number of small pages which make calls to shared class and function libraries which are used by many many pages that serve up the site. Currently, we've been building our work in php3 and are happy with the environment and language. We're working on the next version of our software and need to figure out if PHP will continue to meet our needs. We're concerned for the following reasons: * we'll have a TON of shared code, many thousands of lines for some files * we'll be defining a fair number of classes and derivations of classes I already know that PHP3 won't do what I need for the following three reasons: 1. Class model is too limited (no real polymorphism) 2. Require() and Include() cost even if you never call an included function 3. You pay the cost of an include each time the page is served up I know that PHP4 fixes #1. The class model in php4 is much better, but I don't know if it fixes #2 or #3. If I want to 'make a class library available' in php4, what is the overhead? In Java I have the Import keyword which does the equivalent of a compile-time binding of the libraries with the module, reducing the overhead to almost zero of importing large packages. Does the new implementation (in zend) of require() work the same way, or is there still a large overhead for requiring a large number of files? What about include, is it more or less the same as require? If php4 works more like Java, then I assume the require()d file is compiled and cached. If this is the case, is that cache shared among all pages on a site? For instance, if I require("libraryfunctions.inc"); in every page of my site, is it compiled and cached just once (incurring no overhead except for the first page where it compiled), or is it compiled and cached once for every page on the site? If the answer to the above is that the cache is shared among all pages on a site (which would be great), then what about apache virtual hosts? Does the same compiled and cached libraryfunctions.inc get shared among all virtual hosts which use it? Where can I learn more about the exact details of require() and cacheing in PHP4? I tried digging through the sources to zend but got confused - i'm not enough of a hard core lex/yacc guy for that :-) Thanks in advance for any help you can give me.. garth@spoke.net

« previous php.version4 (#5356) next »