Hi. I'm a newbie at both PHP and Zend. I've just been working on these for
the past couple of months. My goal here is to ensure that my understanding
of the execution model of PHP under apache is correct, and hopefully get
some pointers on speeding things up.

Firebug is showing that it takes 300 milliseconds to show one of my pages,
which is basically just displaying a form. I figured out how to use xdebug's
profiler, and fed the result into kcachegrind, and found that about 30% of
that time is used to get table metadata from the database. I think I know
how to optimize that using the Cache which is described in the DbTable
manual. But, it did get me thinking about the way the execution model of
PHP. 

Let me describe what I understand - hopefully you can correct me if I'm
wrong.

1) I'm using the standard debian apache, built with the prefork mpm. It's
set to start 5 child processes.

2) Each of those child processes runs their own PHP runtime.

3) There's no PHP magic which automatically shares any context between these
runtimes.  (except for php's session extension, which seems to have a memory
map capability)

4) Every time a request comes in, it goes through my /index.php, and
bootstrap, as if it's the first time ever. They don't get any context from
any previous inivocations.

5) Most examples show that you can stuff things the registry, but even that
doesn't persist over multiple requests.

6) I assume that the PHP runtime is not totally reinitialized between
requests, but perhaps only variables are erased.

Here are my main questions:

a) Is there any way to store a variable (I'm thinking things like database
handles, config objects) such that it can be retrieved in the same apache
process when it is processing the next request (not using session, since
that's specific to a user).

b) Is there a way to store a variable such that it is visible in all apache
processes through shared memory.

I am aware that its possible to serialize things out manually and perhaps
use the Cache system, but I am looking for a more direct method of sharing
variables.

(There doesn't seem to be support for these features in Zend Platform
either, right?)

Thanks
Steve


-- 
View this message in context: 
http://www.nabble.com/PHP-Apache-context-tp20389722p20389722.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to