Re: PHP extension initialisation
| From: | Brad LaFountain | Date: | Thu, 15 Aug 2002 13:45:12 +0000 |
| Subject: | Re: PHP extension initialisation | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-86865@lists.php.net to get a copy of this message | ||
--- Tom Oram <tom@scl.co.uk> 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.
>
> 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");
}
>
> 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