Re: Persistent PHP web application?

From: Date: Thu, 06 Jan 2005 16:02:15 +0000
Subject: Re: Persistent PHP web application?
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-205735@lists.php.net to get a copy of this message
> Anything you do in the MINIT hook is basically free, so it would be > trivial to load the data for the array from somewhere. Like a database, > an xml file, etc. So you wouldn't need to hardcode a complex array > structure in your MINIT hook, just have this generic little extension > that creates an array (or object) from some external source. To change > the data you would change that external source and restart your server, > or you could write a PHP function in your extension that forced a reload > with the caveat that each running httpd process would need to have that > function be called since your array/object lives in each process separately. > > If you ask really nicely one of the folks on the pecl-dev list might > just write this thing for you. Especially if you spec it out nicely and > think through how it should work. > > -Rasmus 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...) /jw

« previous php.general (#205735) next »