Re: Persistent PHP web application?

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

 



> > Call me crazy or ignorant, i'm both, but would it be possible to build
> > an extension that, in its MINIT hook as you suggest, actually runs a
> > separate PHP script that contains global definitions, then makes those
> > definitions available to later scripts?  this is basically my original
> > desire of having a one-time, persistent global include for each apache
> > process.  i realize you suggest pulling array data from a source like a
> > DB or XML file, which would be a 90% solution for me, but the next step
> > (a PHP script) just seemed logical/exciting...
> > 
> > i realize i'm reaching with this, and it implies a conundrum (how does
> > an extension run a PHP script if PHP hasn't fully started yet) but this
> > kind of thing is just what makes me go and learn new things (C, php/zend
> > internals) and I just might try to do it if it was feasible, for the fun
> > of it, because it could be useful to lots of people, even if it took me
> > a year or two to pull off.
> > 
> > alas, this is a question for the pecl-dev list.
> > 
> > (the mental gears are churning...)
> 
> The apache-hooks SAPI can do this, although when I initially wrote it 
> nobody seemed interested.  George fixed it/rewrote it to work much better, 
> but nobody was interested in his version either, so the current 
> implementation isn't up to date anymore.  The problem was likely that 
> people really didn't understand how to use it and it is a rather unsafe 
> thing to let PHP scripts fiddle with all the various Apache request hooks.  
> You can really toast your server that way.  A simple generic data loading 
> extension is something people will be able to understand and they are 
> unlikely to destroy their server with it.
> 
> -Rasmus

Does "not up to date" mean the code isn't working with current releases
of php 4 or 5? I'd be interested in giving it a try.

Forgive my ignorance of Apache and PHP internals, but I'm not
understanding the concept of your implementation. I'm not enivisioning
allowing a PHP script to be able to meddle with the Apache request
process.  

I'm picturing an extension that would simply not allow an uncautious or
unknowing scripter to ruin the server, but would only allow him to store
all his app defs and data model startup stuff in a one-shot performance
booster.  It could even do it in a separate (CLI?) interpreter and copy
the data over (but only once!) to the Apache-embedded interpreter using 
a shared memory resource... hmmm.

I'm not versed enough to suggest a feasible implementation, but if 
the overall goal is feasible then I'm willing to climb the learning 
curve.

I'm also quite surprised there wasn't much interest in these concepts, I
admit the benefits would be small for most apps, but complex apps with
large data setup could save valuable time, and having persistent
namespaces/modules is plugged as a worthy feature of mod_perl and
mod_python, for what it's worth.

/jw

-- 
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