The best I ever came up with was doing what your saying but instead of using a file I used an environment variable, it's still a mess but I think its probably cleaner and safe than using file locking. I would still be interested if you ever did find a "proper" solution though,
Sorry I can't help you anymore than that, I hope that was of some use to you Tom On Thu, 12 Dec 2002, you wrote: > Hi Tom, > > Did you ever get this problem solved? > I'm fighting the same issue - and if no better solution present it self, > I'm going > to do it by accessing a file of my choise. If the file doesn't exist - > create it and we > know we are in the first call. If it does exist - delete it, and we know > this is the > second call. This is obviously an ugly hack, so I really hope you've > come up with > something cleaner. > > TIA > Thomas > > On Wed, 21 Aug 2002, you wrote: > >I had already assumed what Pete said was happening was happening, but I > still > >don't know how to tell whether I'm in the first one (apache test) or > the second > >(real init). Any ideas? > >Tom > > > >On Wed, 21 Aug 2002, you wrote: > >> Hi, > >> > >> I asked about this a few weeks ago with apache on windows. > >> > >> The best answer I got was from George Schlossnagle: > >> > >> <quote>I believe this is because when apache does it's intial > configtest run > >> as > >> part of start (to validate it's config), it has to do a complete > startup > >> (otherwise it wouldn't know about conf params used by modules loaded > as > >> DSOs. So you see a startup; shutdown; startup.</quote> > >> > >> that's exactly what I saw happen so seeing as shutdown occurs as well > it > >> wasn't a problem in my case. > >> > >> > >> Pete > >> > >> ------ > >> "Tom Oram" <[EMAIL PROTECTED]> wrote in message > >> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> On Thu, 15 Aug 2002, you wrote: > >> > --- Tom Oram <[EMAIL PROTECTED]> wrote: > >> >> Hi, > >> >> Can someone please answer my question? > >> >> > >> >> When running a PHP extension when PHP is running as an apache > module on > >> linux > >> >> it's module init function (PHP_MINIT_FUNCTION) gets called twice, > once > >> before > >> >> apache forks then once after, is there any way of finding out > which > >> >> init you are in. I can't keep a global variable because it get > losted in > >> >> between init calls, and environment vars/file locks/shared > mem/semephores > >> are > >> >> not options. > >> > > >> > Are you on Windows IIS? I believe someone recently just asked about > that > >> same > >> > thing. There was a valid explination for it. > >> > >> No linux, I did say ;), but thanks anyway. > >> The question still stands open, anyone? > >> > >> >> One other quicky, is there a way to find out inside the extension > if it > >> is > >> >> being run from with an apache module or its it a standalone > executable > >> (or > >> >> running under a different webserver as my module can only ever run > with > >> >> apache)? > >> > > >> > I believe you could > >> > #include "SAPI.h" > >> > > >> > if(!strcmp(sapi_module.name, "cgi") || strcmp(sapi_module.name, > "cli")) { > >> > printf("compiled as a command line executable"); > >> > } > >> > >> This is probably what I need thanks > >> > >> >> > >> >> Thanks for your time, > >> >> Tom > >> >> > >> >> -- > >> >> > >> >> *************************************************** > >> >> Tom Oram > >> >> SCL Computer Services > >> >> URL http://www.scl.co.uk/ > >> >> *************************************************** > >> >> > >> >> -- > >> >> PHP Development Mailing List <http://www.php.net/> > >> >> To unsubscribe, visit: http://www.php.net/unsub.php > >> >> > >> > > >> > > >> > __________________________________________________ > >> > Do You Yahoo!? > >> > HotJobs - Search Thousands of New Jobs > >> > http://www.hotjobs.com > >> -- > >> > >> *************************************************** > >> Tom Oram > >> SCL Computer Services > >> URL http://www.scl.co.uk/ > >> *************************************************** > >> -- > >> > >> *************************************************** > >> Tom Oram > >> SCL Computer Services > >> URL http://www.scl.co.uk/ > >> *************************************************** > >-- > > >*************************************************** > >Tom Oram > >SCL Computer Services > >URL http://www.scl.co.uk/ > >*************************************************** > > >-- > >PHP Development Mailing List <http://www.php.net/> > >To unsubscribe, visit: http://www.php.net/unsub.php -- *************************************************** Tom Oram SCL Computer Services URL http://www.scl.co.uk/ *************************************************** -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php